Skip to main content

Hooks

Event hooks in ftrack connect can be used to extend or modify the default behaviour of the application. They build upon the event system used in ftrack. As such, each hook receives a single argument which is an instance of ftrack_api.event.base.Event.

Hooks are registered by creating a Python module with a function named register that takes a session object and any additional keyword arguments. The built-in hooks can be overridden by creating new hooks and placing them in a directory. Then configure the environment by setting the FTRACK_EVENT_PLUGIN_PATH environment variable.

Each Connect plugin should provide one or more hooks, to activate them, located in the hook directory of the plugin. Connect adds these directories to the FTRACK_EVENT_PLUGIN_PATH environment variable upon plugin bootstrap.

It is also possible to prevent a default hook from being triggered by calling event.stop <ftrack_api.event.base.Event.stop> in a callback with higher priority or by removing the default hook using ftrack.Session.event_hub.unsubscribe <ftrack_api.Session.event_hub.unsubscribe>

info

Unlike regular events, hooks will typically be run synchronously on the system running the ftrack connect application.