This is actually a very good idea. because this way you can kill the loop with turning off the automation for like 5 seconds. I had problems with this and resorted to kill both my scripts multiple times to really get it to stop.
This solution is really flaky. If the action you call takes a few seconds, the loop quickly catches up with itself and you get a “Script script.foo already running.”. This warning appears to automatically immediately halt the script. So this mechanism really cannot be relied on.