Well, for me, I have to have something I want the computer to do for me. That’s what gets me to learn.
Most programming starts by hacking something to accomplish a goal. Example: My nephew who is 10 yrs old, taught himself to hack Cubeworld because he wanted items and to give himself an absurdly big head in the game.
So, he went to various websites, saw a bunch of youtube videos. I helped him a tiny bit when he got stuck, which was more reassurance that “yes, you’re doing everything right”.
Then, a few hours after helping him, he says, “come look look!” and I see his character with a big head, and he had already taught four other people in the game how to do it themselves.
So, incentive. That’s the #1 thing. If you have nothing to program, then there’s no need to learn it.