uninitializePlugin()
 
 
 

uninitializePlugin(), like initializePlugin(), can be a C or C++ function. If you neglect to declare this function, your plug-in will not be loaded.

The uninitializePlugin() function contains the code necessary to de-register from Maya whatever was registered through initializePlugin(). It is called once only—when the plug-in is unloaded.

This function should be used for a few quick clean-up operations, such as closing files. It is not necessary for you to delete those commands, or nodes created by your plug-in when it exits since Maya takes care of them. You should therefore not be keeping a list of the Maya objects allocated by your plug-in nor freeing them when uninitializePlugin() is called.