Maya -


I want to have control over when users launch tk-maya.
I want all workstations to read the same unique inside of sgtk config, so that users can customize their own files if they want.

I see there is already install\app_store\tk-maya\v0.9.7\startup\ that looks excatly like what I want, but I don’t understand how the file is linked to sgtk config as I can’t find any hook key associated to this file in tk-maya.

I imagine I can also use tk-multi-launchapp\, but trying to add to tk-multi-launchapp breaks my whole config as I don’t know what windows_path, linux_path and mac_path keys are supposed to be.

Can you point me to the right direction here? Using would be the best option I think.



Hi Ben

So first thing to say, is you shouldn’t modify the install\app_store\tk-maya\v0.9.7\startup\ file. This is there purely for Toolkit to handle bootstrapping of the engine. You should use your own separate

The hook sounds like the right way to go. You can add the path to your chosen file, by appending it to the PYTHONPATH.

You can use the following utility method to append a path to the env var:

sgtk.util.append_path_to_env_var("PYTHONPATH", path_to_your_usersetup_file)

If you’re bundling your custom file in with the config, you can access the hooks folder in the config by running the following from the hook:

Then you could modify that path to get to a different folder if needed.


1 Like

Hi Philip,
Thanks for your answer.

I wouldn’t dare modify a file in the install/ folder! That’s my exact problem: I did not know how to telle sgtk to load {config}/tk-maya/

I’ll try appending path to PYTHONPATH. I did not know maya would launch any in this environment variable at startup.

sgtk.util.append_path_to_env_var("PYTHONPATH", path_to_your_usersetup_file)
the exact same thing as
os.environ["PYTHONPATH"] or is this a sgtk special PYTHONPATH?

Concerning, I’m currently trying to make this work but have problems with implementing the settings in tk-maya:

:diamonds: copy to {config}/tk-multi-launchapp/
:diamonds: add those lines to tk-multi-launchapp.yml:
engine: tk-maya
location: ""
hook_before_app_launch: "{config}/tk-multi-launchapp/"

:diamonds: add tk-multi-launchapp: "" to the apps part of your different environments in tk-maya.yml

I’m not exactly sure I’m right there as this gives me errors when launching SG Desktop, but I think that’s the logic here?

TankError: Include error. Could not resolve references for L:\_tech\sgtk_sandbox\config\env\.\includes\settings\tk-maya.yml: Undefined Reference!


Yes, it’s the same env var, it’s just a convenience method, for taking the current PYTHONPATH value and adding a new string to the end of it separated by the path separator. It runs this code essentially:

You could do it your self, but just make sure you don’t overwrite the current PYTHONPATH value as Toolkit won’t bootstrap, you must append to it.

I’m guessing you created the block? You shouldn’t normally need to do this. I posted on the other thread you replied to with the instructions on how to add the hook:

Though technically the error you are getting is that your tk-maya.yml doesn’t know where to find the settings block, as you probably haven’t included the tk-multi-launchapp.yml in the includes section of the file. However I think this is the wrong approach anyway, so I would follow the steps in the other post and see if that works for you. (And remove changes you made to the tk-maya.yml and tk-multi-launchapp.yml.)

Hope that helps, let me know if anything is not clear and I’ll try to clarify!


Works perfectly! Thanks Philip

If anyone need help, here’s what I did with Philip advices:

:diamonds: created hooks in tk-multi-launchapp.yml under and (not sure what this second one is doing)

hook_before_app_launch: "{config}/tk-multi-launchapp/"

:diamonds: created my methods in {config}/tk-multi-launchapp/ The first method I call makes sur PYTHONPATH is setuped as I want.

:diamonds: also added’s folder path to PYTHONPATH through a method that only execute if engine_name == ‘tk-maya’


That sounds spot on!

FYI the second block is used purely by the tk-shotgun engine. In other words those are the settings it will use if you launch a software via the browser integration. I’m not totally sure why the browser integration needed skip_engine_instances: ["tk-nukestudio"] specifically, but that is the difference.