When exactly core hooks are called

Fair enough… perhaps in the meantime I could put forth my hypothetical situation that brought on this question?

We have 2 different types of projects at a studio. Both use the same exact config. The only difference between the two is the templates. Ideally it’d be nice to not have to manage 2 separate configs for this (especially since the templates also overlap about 95%). So I have been experimenting with using an environment variable to designate what template should be used.

I’m currently using the bootstrap.py core hook that looks at the “Type” field on the SG Project for the current pipeline config and sets the env variable. Then I have a single template file core/templates.yml that includes another template file based on that environment variable.

include: 'templates/templates-$TK_PROJECT_TYPE.yml'

This works well at first when you load things up in SG Desktop :smile:, but then if you click out of the Project and back in, it fails to set the env variable :frowning_face:. So I don’t have the right place for this logic. It also seems to fail in the Shotgun engine in some cases.

So… where would the right place for this logic be where I know my pipeline config but before anything has actually be initialized/verified? And how can I ensure it will be run every time?’’

Wondering if anyone else has done this as well?

3 Likes