pymel.mayautils.executeDeferred

executeDeferred(func, *args, **kwargs)

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.

Use this function in your userSetup.py file if:
  1. you are importing pymel there
  2. you want to execute some code that relies on maya.cmds
  3. you want your userSetup.py to work in both interactive and standalone mode

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.

Previous topic

pymel.mayautils.source

Next topic

pymel.mayautils.getMayaAppDir

Core

Core Modules

Other Modules

This Page