Custom hook : problems defining path of hook


I’m writing a custom hook that will be used in the tk-multi-workfiles2 app.
The tk-multi-workfiles2 app has a setting : “saveas_default_name” which I want to attach my hook to. I want the default name to be the name of the current pipeline step.

If I store my hook file ( in the \install\core\hooks\ and define it in the yaml file like;
   saveas_default_name: hook:saveas_default_name_tk-maya

Then it will work

Of course, I would prefer to put my hook inside the configs hook folder. I tried a few things like;

saveas_default_name: hook:"{config}/tk-multi-workfiles2/"

But that does not work; I get an error in maya; Shotgun tk-multi-workfiles2: File Model: Search 5 failed - Cannot execute hook ‘\VSERVER01\shotgun\devdo2021_P99999\install\core\hooks"{config}/tk-multi-workfiles2/".py’ - this file does not exist on disk!

How should I specify the correct path for my hook ?


Looks like if you use hook: prefix it (reference) will call on the hook via sgtk.api.execute_core_hook when what you’re expecting is that it is called via sgtk.platform.bundle.execute_hook in the same way a ‘normal’ hook in the bundle configuration would be called from a abc_hook: expression/path/to/ key/value pair.

I can’t see any reason for this to not be updated aside from the fact core hooks are referenced by name and not path, where .py is appended blindly to the hook name or value, so this could affect existing configurations that are setup correctly albeit in a limited manner.