pymel.api.plugins provides classes for creating dynamic plugins
outside of the context of a python module: no need to save out a file
and put it on MAYA_PLUG_IN_PATH, you can create new mel commands on
the fly, from a regular python module or from within the script
editor. for an example of how to use it check out
pymel.tools.py2mel.WrapperCommand, which generates mel commands from
python functions and classes. coming up next: a similar tool for
dynamically making new node types.
here's the super simple example:
from pymel.api.plugins import Command
class testCmd(Command):
def doIt(self, args):
print "doIt..."
# create the command
testCmd.register()
# use the command (this is not the same as the class: notice that it's
in the maya.cmds module
import maya.cmds as cmds
cmds.testCmd()
# get rid of hte command
testCmd.deregister()
keep in mind that this is an experimental feature: it may move
locations or change slightly, but it's there for the brave to try out.
-chad