Breaking out of a script

Hello! Very quick (and hopefully simple) question about scripts within Ignition.

Is there any way to exit a script without completely executing it? Something like the break command, but for the entire script? The idea would be to stop the script entirely if certain conditions would otherwise cause it to throw errors. Thank you!

OK - I should have spent more time looking in the forum… The answer is clearly to use “return” to exit from the script!


OK I should have actually tested this before responding to my own post. To avoid further confusing people I’ll post kind of the same thing someone else commented on already (this does work):

Method one:
from sys import exit

Method two:
Place entire script into function
use return