Initializing and uninitializing plug-ins

Two specific functions, initializePlugin() and uninitializePlugin(), must be implemented in all Maya plug-ins. initializePlugin() is called when Maya loads the plug-in, and uninitializePlugin() is called when Maya unloads the plug-in. If either of these functions is missing, the plug-in will fail to load.

For a command plug-in, initializePlugin() must call registerCommand() to register the command. Similarly, uninitializePlugin() calls deregisterCommand().

For a dependency node plug-in, initializePlugin() must call registerNode() to register the command. Similarly, uninitializePlugin() calls deregisterNode().

You can see how these methods are implemented and work together for both Maya Python API 1.0 and API 2.0 in the examples packaged with the Maya devkit.