How to stay motivated to write, even when things aren’t going well

How to stay motivated to write, even when things aren't going well