Hi, I just lost a day to this so I’m making a post to raise awareness
It looks like Maya 2019 calls userSetup.py earlier than it used to. I upgraded a few days ago and my toolset worked as usual, until at some point after closing and re-opening Maya my userSetup stopped running the studio menu and rollback importer.
The solution was to nest the imports from my studio tool-set and calls under a function to be called in cmds.evalDeferred([function], lowestPriority=True) and to store my menu and rollback variables under main
Has anyone else struggled with this?
def start():
from sys_utils import mk_menu
from sys_utils.rollbackImporter import RollbackImporter
import __main__
__main__.rollback = RollbackImporter()
__main__.mkMenu = mk_menu.MKMenu()
cmds.evalDeferred(start, lp=True)
That shouldn’t be the case. PYTHONPATH is evaluated at interpreter startup, you can’t run a python file without that happening. In fact the logic to check for userSetup.py relies on parsing PYTHONPATH
I don’t have 2019 in front of me to check, but C:\Program Files\Autodesk\Maya2019\Python\lib\site-packages\maya\app\startup\basic.py is where the logic for when userSetup.py is evaluated should exist.
All I know is if I don’t run my imports in deferred evaluation with lowest priority they won’t import, and if I don’t store my rollback under main manually I can’t access it after initialisation.
I’ve just updated from Maya 2018 to 2019.1
I think it’s a bug more than anything; userSetup was running fine as usual for a few days in 2019, then suddenly this happened. Maybe userSetup is supposed to be called after Maya.Env, but I can tell you that’s not what’s happening on my machine, or for anyone in my studio I’ve tested it with
I haven’t decided if it’s worth upgrading the whole studio yet; the updates to the evaluation models are super awesome, but looks like a couple of under the hood edits that I’m not heaps happy with.
Two of our animators use it but it’s not on the machines that were having the issue so far
I have identified that in some cases with Maya 2019, UserSetup.py is running before Maya.Env so my studio tools aren’t able to be imported without deferred evaluation
My gut is that PYTHONPATH is being set on Maya start up, but some higher priority tool, plugin, is overriding it prior to calling the userSetup.py. Can you attach a debugger to Maya and see what its calling on startup?