how to know if the user tried to exit a python app code example Example: exit python script import sys sys.exit()