How to get templates within before_app_launch.py

Hi,

I’d like to access templates within the engine context (in this case Nuke) before it launches.
However whenever I use self.parent.sgtk.templates['some_template'] it always comes up as None.
Is there some way to access project templates within the app context?

1 Like

Hello –

I tried this and it worked for me. I have the following in before_app_launch.py:

        work_template = self.parent.sgtk.templates['maya_shot_work']
        self.parent.log_info("work_template is %s" % work_template)

And on running ./tank maya_2019 from the pipeline config root in the shell, I get this output:

work_template is <Sgtk TemplatePath maya_shot_work: sequences/{Sequence}/{Shot}/{Step}/work/maya/{name}.v{version}.{extension}>

Not sure what’s different in your use case, but maybe that example jogs something?

2 Likes

If that doesn’t help feel free to drop us a support ticket and include a copy of your config and the actual template you are trying to access so we can take a closer look.

1 Like

Hi All,
Sorry. I got sidetracked. I did test this again with the above code but I got nothing. (this was for nuke). I was trying to define a before_app_launch hook for maya but I haven’t had a chance to finish.

I’ll try it out today or Monday and get back to you.

thanks!

2 Likes

I’ve confirmed it doesn’t work for maya either.

What do you mean by a copy of my config? The whole thing?

1 Like

Hello – Yeah, if you can zip up the config/ folder in your pipeline configuration and attach it to the ticket you submit, that lets us take a look and see if there’s anything set up incorrectly that might be leading to what you’re seeing.

You can email support@shotgunsoftware.com or go to this page to submit a ticket.

Please include a link to this forum post so we can connect the dots. Thanks!

1 Like