How to stop/terminate a script that is not attached to a node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tachekentya

Hello. I need some help with this: How to stop/terminate a script? something like the exit() in python. The script is not attached to a node so get_tree().quit() is not working. The idea is that if a condition is met, the program stops

:bust_in_silhouette: Reply From: volzhs

try Engine.get_main_loop().finish()