This happens to me all the time, because my brain is like a magnet - if an unwary idea passes too close, it gets stuck. >.< I've been forced to work up a sense of dedication through practise; I'm disciplined enough to keep working on my main project no matter what, but it isn't always easy.
If it's just the brief beginning of an idea - a "hey wouldn't it be cool if [story idea]?" - then I write it down somewhere and leave it for later, and maybe doodle some art for it during breaks/spare time. If it's insistent and doesn't leave me alone, I sit down and do a chunk of planning for it, without starting the actual serious drawing. It's enough to keep the part of my brain where the idea lives happy and quiet, so I can focus on working on my main project.
.... and sometimes I just give in and end up working on all the things at once. Like now. ^_^; I'm working on Grassblades, I'm working on an unrelated Christmas oneshot (yes I know it's still only August), I'm thumbnailing a graphic novel to pitch for a grant opportunity, I'm working on my ongoing Tea Witch illustration-project, and I'm flatting pages for a friend.
The word you're looking for is "workaholic" and no, it's not a good idea, and it's not the healthiest behaviour. Don't be me, kids.
However - in general, it helps that I'm fairly disciplined. Even on days when I don't feel ~inspired~ or in the "mood" for drawing Grassblades, I still do it. It needs to be done; it's right there on the to-do list. So I sit down, I plug my ears with a podcast (right now working my way through Critical Role, but my list of podcasts is longer than my arm) and I work. Get up early in the morning, make a cup of tea, and draw.