How to fix scripts.yaml

Still very much in HA learning mode. I made the mistake of modifying scripts.yaml (deleted a script) and now if I go to Configuration->Scripts, the script still shows up and if I click to edit it, it says (perhaps not surprisingly) that only scripts in scripts.yaml can be edited. How do I get back to having the scripts.yaml file and the configuration->scripts being in sync?

BTW, I was trying to create a script which would toggle a light on/off for a period of time and since this cannot be done in the Visual UI, I figured I needed to edit scripts.yaml but perhaps that is not the right way to go about this. (does anyone have such a script?)

It seems that restarting HA fixed the problem (perhaps just reloading scripts.yaml would have worked as well).

Yes, reloading would have fixed it.

When you create or modify a script using the Script Editor, at the moment you save it, Home Assistant checks it for syntax errors and, if there are none, automatically reloads all scripts.

When you create or modify a script directly in the scripts.yaml file, using a text editor, you assume the responsibility for ensuring it has no errors and manually reloading scripts.

To check the configuration:

Configuration > Server Controls > Check Configuration

To reload scripts:

Configuration > Server Controls > Reload Scripts