Same as any other kind of artist, writers also suffer from this condition. The causes differ and depend on each person, just like the ways to overcome it. Every person should find their own way to deal with it, so if you’re looking for a solution to this very problem… I’m sorry, but I can only speak for myself. My answer to this question may not be able to help you in particular, but I wish it did. I hope you find your way back, and please let me know if I can help in any way.
In my case, writer’s block was not a lack of inspiration. I had ideas, and sometimes I wrote them down, but I didn’t do anything else with them (for years) because of my insecurity. Still, I was struggling at the time, so it wasn’t a complete block. In a way, I’m used to dealing with anxiety and my lack of self-confidence, so I can get things done most of the time. Yes, these are problem I should deal with, but things got worse.
When my anxiety got so bad it reached the stages of burnout and depression, I stopped writing. I had to. Whenever I had to use my computer, I wanted to throw it out of the window. I had panic attacks sometimes.
So I did what I had to do and stopped writing. I changed my habits, reduced my workload and spent one year focusing on work (because I couldn’t stop working) and taking care of myself.
I took walks, played videogames, avoided my computer and didn’t write anything new. Not even on my notebooks. I even stopped reading for a while.
It was hard because I’ve spent all my life working (even school and extracurricular activities are work) and stopping to rest made me feel useless, but I persevered. And then, one day, I started feeling better. I wanted to read again, but I couldn’t trust new books yet, so I started rereading some of my favourite books. Little by little, I started to enjoy it again. And then I started therapy, and it all went even better after that.
I took some holidays and I just went to the beach and relaxed for the first time in many years. That couple of weeks helped a lot and I started writing in my notebooks again, and also transcribing my old notebooks. I even created this blog. And I started writing a fanfic because I thought it would be fun.
It’s been over a year and I’m still fighting, but I think the way to overcome writer’s block is… basically patience and perseverance. I know that isn’t very helpful, but that’s how you learn to take your time and do what you need in order to get better. The solution depends on the reason why you suffer this condition, and it may involve not writing at all. So if taking relaxing baths and walking in a forest is what helps, don’t think of it as Not Writing. Resting doesn’t have to be the opposite of work. Relaxing is hard work and, more importantly, it’s necessary if you want to keep working (and living), so I now consider it a very important part of my day. Try doing something that makes you happy (or that used to make you happy if you have depression), and remember that the mind needs time to heal.