I need to launch Maya with a custom MAYA_MODULE_PATH env variable.
From this documentation
It seems the expected method is to edit before_app_launch.py and add custom code
My challenge is I cannot seem to identify the correct path to the before_app_launch.py which I am supposed to edit.
I had to edit as admin to save my changes, but the environment vars were not set after launching Maya via shotgun create.
There is NO before_app_launch.py in my %APPDATA%\Shotgun\bundle_cache…
We are running SG cloud, there are no local pipeline config/hooks and config/env folders
I can’t create a local config/ directory using Advanced Project Setup Wizard as in Configuration Setup - SG Developer (shotgunsoftware.com)
Because the project is already configured and the process errors out.
This is the correct hook for what you want to achieve.
Never ran distributed configs, but I guess you have to modify the hook, zip and upload the new configuration to Shotgun. Check out
(don’t know how that works during development but I’m sure there is a way to use your hook locally)
Juist like @mmoshev said the best way is to download your config from your site, modifiy it pack as zip and reupload.
You should copy before_app_launch from your_config\install\app_store\tk-multi-launchapp\v0.11.2\hooks\before_app_launch.py to
your_config\hooks\tk-multi-launchapp for example. And modify execute method, it can look like this:
def execute(self, app_path, app_args, version, engine_name, **kwargs):
tk = self.parent.sgtk
project_path = tk.project_path
context = tk.context_from_path(project_path)
if engine_name == 'tk-maya':
"""Here put code to add environment variable"""
What you need to remember is to modify your_config\env\includes\settings\tk-multi-launchapp.yml.
If i remember you should put hook_before_app_launch: “{config}/tk-multi-launchapp/before_app_launch.py” for tk-multi-launchapp settings.