I struggle with that too but honestly, it gets a lot easier if you just cut down on the size of your projects, so having several of them at once isn’t overly ambitious.
That, and practice a little bit of discipline when task switching, i.e. always leave things in a state where you can easily pick them up again and remember where you were.
As I’m getting better at it, I find that there’s usually always something I can make progress on, even if it’s just a little before I stash it away again. But progress is progress, no matter how small, and it does end up adding up by the end of a week and then I don’t feel as useless and defeated as I used to.