Coming Back From an Injury

After lifting hard for 8 years I have been unable to train for several months after being seriously injured in an accident. I have been trying to come back slow but have been getting these violent muscle spasms. They are worse when I train but I even get them at rest when I’m watching TV or just lying in bed.

Has anyone experienced this?? Have my muscles atrophied so much that I am experiencing these spasms in response to not being able to train? This whole experience has been unbelievably frustrating and I really appreciate any advice.