One of the perverse quirks of cognition is that we overestimate how similar the future will be to the present. When we imagine things twenty or thirty years from now, we think of a world with flying or driverless cars. We don't imagine a world in which everyone travels by jetpack or rocket-filled sneakers. Our imagination is constrained by the current state of things.
This same phenomenon can be seen on a shorter time scale in our own personal lives. When we think about how we'll act or what we'll find motivating in the future, we tend to overemphasize our current actions and desires. We assume that we'll always be a runner, or that we'll always like Bruce Willis movies, or that we'll always be a vegetarian. If we're currently motivated to learn how to code, we assume that we'll feel the same way tomorrow, and next week... and next week.
Why we lose our motivation
There are a couple of reasons why this is the case. First of all, our imagined futures are produced by our present-state minds. This means that the current emotional state of our brain biases our future-projected perception. Feeling happy? You'll probably imagine a happy future. Feeling down? You'll probably imagine a dark future.
In addition, our minds are heavily influenced by the memories that have most recently been activated. We've all had the experience of going to a lecture and then being able to flawlessly recall what we covered immediately after. However, by that evening, or the next morning, it's also likely that you struggled to recall even a fraction of the material. If, immediately after the lecture, I had asked you to predict how much you would be able to remember the next morning, you would probably have confidently said "oh, almost all of it". That's the power of this illusion.
The second reason we assume that the future will look a lot like today is because we are creatures of habit. All of us understand that a substantial portion of our life operates on autopilot. But most of us overestimate how habitual we are. Only about 40% of our behaviors are habits. That means that 60% of all the actions we perform are going to vary based on the new needs and desires we encounter. How we act and feel today are thus going to be weaker predictors of what we'll say and do tomorrow than we might think.
This is why you should always step back from your projections of the future and ask: "Is this really how things will be? How am I currently feeling? What have I recently been thinking about?" Once you have your emotional and recency biases on the table, you can begin to correct for them.
When in doubt, do it now
In order to prevent these biases from harming your future actions, you should also build reminders into your life. No matter how excited you are about something now, it is unlikely that you will feel the same exact way in a day let alone a week or month. No matter how top-of-mind it is for you to do something, when tomorrow morning rolls around it's very likely that you will have forgotten. Fight against this tendency and just assume that in the future you'll be unexcited and forgetful about whatever it is you're thinking about now.
If it is something that is truly important to you, figure out how you're going to make sure you remember and can get re-energized by it. Schedule calendar events to jostle you out of your forgetfulness. To keep yourself motivated, give a friend some money that they can keep if you don't follow through with your plan. Whatever you do, don't do nothing. Don't let the bias win.