A function decorator used to insert a function into designated places in the model’s logic. See the Hooks Reference for a complete list of possible hooks and the function signatures necessary to use them.
This decorator can be used bare (i.e. without parentheses) on a function whose name corresponds to a hook name. It can also take one argument, the name of the hook, to insert a function with any name into a designated hook. Further keyword arguments (e.g. prioritize
) are passed to Hooks.add()
.
Parameters
place — str, optional
The name of the hook in which to insert the function.
Default value: None
prioritize — bool, optional
Run the hook before all existing hooks in the queue. Note this parameter does not affect the position of the hook with respect to future functions added to the same hook.
Default value: False
charwick
Aug 06, 2020 at 3:49This snippet hooks the defined function into the
modelStep
hook. Note that it does not need parentheses if the function name corresponds to a hook name.The function can also be named anything at all, passing a hook name argument to the decorator.