> For the complete documentation index, see [llms.txt](https://bkortbus.gitbook.io/unreal-python-recipe-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bkortbus.gitbook.io/unreal-python-recipe-book/startup-and-shutdown-scripts/shutdown-script-management.md).

# Shutdown Script Management

calling Python functions on Editor Shutdown

Editor Shutdown is less involved than Editor Startup, we just need a function to connect to the callback is all:

```python
def on_editor_shutdown():
    print("Running Editor Shutdown code")
    
    
shutdown_id = unreal.register_python_shutdown_callback(on_editor_shutdown)
```

{% hint style="danger" %}
While the implementation is simple, the Editor state is incredibly limited when our hook gets called, it's best to assume that any Editor Utility Widgets and general Editor Tools have already been closed by Unreal by the time our function gets called
{% endhint %}
