You said this happened to you lately. Perhaps your story hasn't had time to "cook" yet. Professional writers like James and some of the others will always advise you to sit down and write.
I don't think that always works. If your creative mind hasn't finished working, you're going to write junk and you may get off track from where you wanted to be. The best way to get your creative mind working, is to do mundane tasks with the other half of your brain. Balance your checkbook, count the number of days till your birthday, read a related book. If your story is about pirates in the 18th century, read about buccaneers and pirates. Conduct other research on your story. Don't waste your time, but don't try to force your creative mind to birth its child before the gestation period is complete.
Always sit down and write. There's plenty of time in the day to do mundane things. Even if you write four hours per day, and sleep eight, there's still twelve hurs to do whatever it takes to get your mind in gear.
Creative minds don't birth children, they write books, and they react to the way we train them. Start thinkof your books as children, and they'll probably all be stillborn.
Writers write books, and the only way they write books is by planting butt in chair and writing. This is how we become professional writers, right from day one.
Writers write junk eithe rbecause they lack talent, or because they train their minds to write junk by not planting butt in chair often enough.
As someone once said, "If you want the muse to help you, she must know where you are, and when you'll be there."
It's true. You can think until Satan starts selling ice cubes, but unless you train your mind to write well when you're actually sitting there wanting to write well, it's never going to work.
We are our habits. If you habit is to walk away, you'll keep writing junk. If your habit is to plant butt-in-chair at pretty much the same time and same place nearly everyday without fail, it won't be long ebfore your "creative mind" is trained to perform when you're actually sitting there writing. The muse knows where to find you, and when you'll be there.