Python has async kill signal handling:
import signal import sys def signal_handler(*_): print("\\nExiting...") sys.exit(0) signal.signal(signa