I'm trying to delay a part of my pipeline tool (which runs during the startup of Maya) to run after VRay has been registered.
I'm currently delaying the initialization of the tool in a userSetup.py like so:
Uiron over at tech-artists.com showed me how to do this properly. Here's a link to the thread
Here's the post by uiron:
"don't pass the python code as string unless you have to. Wherever a python callback is accepted (that's not everywhere in Maya's api, but mostly everywhere), try one of these:
# notice that we're passing a function, not function call mc.scriptJob(runOnce=True, e=["idle", myObject.myMethod], permanent=True) mc.scriptJob(runOnce=True, e=["idle", myGlobalFunction], permanent=True) # when in doubt, wrap into temporary function; remember that in Python you can # declare functions anywhere in the code, even inside other functions open_file_path = '...' def idle_handler(*args): # here's where you solve the 'how to pass the argument into the handler' problem - # use variable from outer scope file_manip_open_fn(open_file_path) mc.scriptJob(runOnce=True, e=["idle", idle_handler], permanent=True)