How do you overcome "writer's block" - when one thing you want to make doesn't work, and it takes a while?
Most recently, Cake took me a quite a while, where I had at times weeks with an unwillingness to continue because I had to do a tricky bit and I had no good ideas for how to go about it.
Inevitably though I would be working on something else and realize that if I had Cake, this would be much easier.
So for me, a lot of my motivation to persevere is because I build tools that make the hard tasks in other projects easier.
I recommend aiming for more discipline in general. It's all too easy in this comfy era we live in to not push through hard spots. Ultimately though mastery of a craft requires diligence, hard work and keeping at it.