When you have a strong locus of control, staying motivated is a piece-of-cake 🍰.
Develop a strong internal locus of control
Locus of control is the degree to which people believe that they have control over the outcome of events in their lives.
If you believe that the events in your life are primarily a result of your own actions, you will credit/blame yourself. This makes you want to change your behavior, instead of waiting on external forces to change in your favor.
You and you alone are responsible for making it happen. There is always time, there is always a way. Never blame external events or conditions.
No one can control what they're born with, but everyone can control how much effort they put in.
Make it as easy as possible
Getting started should be easy as possible. Small tasks like turning on your PC, opening your editor, opening documentation, etc ... can keep you from putting in the work.
Leave your PC on. Leave your editor open. Leave documentation open. Leave your laptop plugged in and fully charged.
Commit to spending time learning and doing every day. One hour every day might not be a lot, but it's ridiculously better than doing nothing or wasting your time.
Realize that your time is valuable, and only you can decide how to spend it.