What you should use instead is “inotifywait” [2] to execute your program(s) whenever there is a change. This way the program will run, for example, every time you save your changes. There are many utilities that make use of inotify (the library that powers inotifywait) some of them are fsnotify [3], fswatch [4] and watchexec [5].
[1] https://linux.die.net/man/1/watch
[2] https://linux.die.net/man/1/inotifywait
[3] https://github.com/fsnotify/fsnotify (written in Go — golang)
[4] https://github.com/emcrisostomo/fswatch (written in C++)
[5] https://github.com/watchexec/watchexec (written in Rust)
I only found out about it few days ago, but it seems nice so far.
A good idea would be to at least run the script in some kind of sandbox, so you don't accidentally do something dumb.