exit(exit_code=0, suppress_save_prompt=False)
The exit confirmation prompt only appears if the session has unsaved changes. This function will not return until after the user has made a choice from the prompt. If this function is called from outside Houdini (e.g. MPlay or a non-graphical Python shell), the dialog is not displayed and suppress_save_prompt==True is implied.
Note that if the user chose to exit, this function will raise a Python SystemExit exception to ensure the executing Python script terminates. This approach ensures that the next Python statement will not be executed, since Houdini may add events to its event queue that carry out the actual shutdown, or hou.exit() may be called from a different thread than the one executing the shutdown.
Note that if you call sys.exit() from within the interactive Houdini Python shell, it will call hou.exit() with suppress_save_prompt=True. The Houdini Python shell does this by intercepting the SystemExit exception raised by sys.exit() and calling hou.exit(). Since both sys.exit() and hou.exit() both raise SystemExit exceptions, the shell calls hou._isExiting() to differentiate between the two.
Avoid calling sys.exit() from any place other than the interactive Houdini Python shell, such as non-graphical Python shells, and instead call hou.exit(). Using hou.exit() ensures that Houdini shuts down cleanly.