This is a wrap for maya.utils.executeDeferred. Maya’s version does not execute at all when in batch mode, so this function does a simple check to see if we’re in batch or interactive mode. In interactive it runs maya.utils.executeDeferred, and if we’re in batch mode, it just executes the function.
Example userSetup.py file:
from pymel.all import *
def delayedStartup():
print "executing a command"
pymel.about(apiVersion=1)
mayautils.executeDeferred( delayedStartup )
Takes a single parameter which should be a callable function.