HookScripts are plugins that run at defined points (“Hooks”).

They expose a hook_function with signature:

opentimelineio.hooks.hook_function(timeline: opentimelineio.schema.Timeline, optional_argument_dict: dict[str, Any]) opentimelineio.schema.Timeline

Hook function signature

Both hook scripts and the hooks they attach to are defined in the plugin manifest.

Multiple scripts can be attached to a hook. They will be executed in list order, first to last.

They are defined by the manifests HookScripts and hooks areas.

    "OTIO_SCHEMA" : "PluginManifest.1",
    "hook_scripts" : [
            "OTIO_SCHEMA" : "HookScript.1",
            "name" : "example hook",
            "execution_scope" : "in process",
            "filepath" : ""
    "hooks" : {
        "pre_adapter_write" : ["example hook"],
        "post_adapter_read" : []

The hook_scripts area loads the python modules with the hook_functions to call in them. The hooks area defines the hooks (and any associated scripts). You can further query and modify these from python.

import opentimelineio as otio
hook_list = otio.hooks.scripts_attached_to("some_hook") # -> ['a','b','c']

# to run the hook scripts:"some_hook", some_timeline, optional_argument_dict)

This will pass (some_timeline, optional_argument_dict) to a, which will a new timeline that will get passed into b with optional_argument_dict, etc.

To edit the order, change the order in the list:

hook_list[0], hook_list[2] = hook_list[2], hook_list[0]
print hook_list # ['c','b','a']

Now c will run, then b, then a.

To delete a function the list:

del hook_list[1]

class opentimelineio.hooks.HookScript None
run(in_timeline, argument_map={})

Run the hook_function associated with this plugin.


Return the names of HookScripts that have been registered.


Return the HookScripts objects that have been registered.


Return a list of all the registered hooks., tl, extra_args=None)

Run all the scripts associated with hook, passing in tl and extra_args.

Will return the return value of the last hook script.

If no hookscripts are defined, returns tl.


Return an editable list of all the hook scripts that are attached to the specified hook, in execution order. Changing this list will change the order that scripts run in, and deleting a script will remove it from executing