No need to restart home assistant, you can reload scripts and some other things at configuration > server controls. Enable advanced mode in your profile if you can’t see it (the icon at the bottom of the sidebar). Also you can now use that script in an automation, Lovelace card, etc. or execute it manually at developer tools > states or configuration > scripts.
Use the </> icon in the comment menu bar to format the text! It’s hard to tell if you have a syntax or spacing error. That button will preserve spacing (and even highlight things) for you.