I am running Maya from Python with subprocess to set the necessary environment.
If I add a PYRHONPATH to my custom package ( os.environ[‘PYTHONPATH’] =‘my/path’), Maya prints error:
cannot find procedure MTsettogglemenuitem
and does not launch.
Can you help me to troubleshoot the issue? I have no clue where is the problem (without this path maya launches normally). Also, Maya 2016 launches normally with this path.
The only option I can think of is that I have some modules/packages names that conflict with Maya. E.g. I have core, setting, database and other names…
The issue cause custom module “maya” with Maya tools an userSetup.py. Renaming module solve the issue… but still, I don`t get whats going on (its working fine with 2016).
Sorry I can’t troubleshoot the exact issue right now, but maybe a workaround will suffice?
Instead of the PYTHONPATH variable, maybe you can do a sys.path.append('my/path') ?
Of course, depending on the order you’re doing things it may or may not be useful to you.
Yeah, so 2018 added a bunch of new plugins / modules that totally screw with some module names.
Also you definitely don’t want to be running stock 2018, as it scrambles the import paths during startup.
I believe 2018.1 was when the fix landed.
You probably should look into namespacing your code by placing it in a package, and using relative imports internally so that these kind of conflicts are less likely to happen.