For example, when you are coding or learning something - You understand that it's interesting, but there's also another will to go and do something else.
How do you solve this problem?
Tony Schwartz recognizes this problem and offers a suggestion:
Finding an excuse to avoid hard work isn't hard to do.
I work for 90 minutes because that's what the research suggests is the optimal human limit for focusing intensely on any given task. This "ultradian rhythm," the researcher Peretz Lavie and others have found, governs our energy levels (see page 51 for details).
Over the course of 90 minutes, especially when we're maximally focused, we move from a relatively high state of energy down into a physiological trough.
Many of us unwittingly train ourselves to ignore signals from our body that we need a rest — difficulty concentrating, physical restlessness, irritability. Instead, we find ways to override this need with caffeine, sugar, and our own stress hormones — adrenalin, noradrenalin, and cortisol — all of which provide short bursts of energy but leave us overaroused.
By intentionally aligning with my body's natural rhythms, I've learned to listen to its signals. When I notice them, it usually means I've hit the 90-minute mark. At that point, I take a break, even if I feel I'm on a roll, because I've learned that if I don't, I'll pay the price later in the day.
I don't get it right every day, but this single practice has been life-changing for me.