A tried and true method to create motivation to learn something is to sign up for a class that you'll get a grade in. You can take college courses without being in a degree program. Otherwise, I have no idea. I was internally motivated when I learned to code, way back when I was a child. It's harder to summon that kind of motivation if you haven't had it already by the time you're an adult.