The order actually follows
sys.path, you can actually find the
userSetup.py behavior in
maya.app.startup.basic.executeUserSetup, in fact if you need to rerun
userSetup for some reason you can call that function and it will do so.
You are correct that this all runs well before the GUI.
However, I would do this a bit differently, instead of passing a string into
executeDeferred you can hand it the function object and it will call it for you at the proper time. The nice thing about this is you can pass
*args, **kwargs along with it.
import maya def yourMethodName(standalone=False): #do python stuff here once GUI’s loaded. pass maya.utils.executeDeferred(yourMethodName, standalone=True)