If I add a callback to a node like this:
import maya.api.OpenMaya as om
mayaCallbackID = om.MNodeMessage.addAttributeChangedCallback(mObj, myFunc)
and then later I do
om.MMessage.removeCallback(mayaCallbackID)
I get the error
#RuntimeError: (kInvalidParameter): No element at given index
If I look at the callbacks on the node like this:
print om.MMessage.nodeCallbacks(mObj)
I can see that mayaCallbackID is among the IDs on the node.
I see examples of MNodeMessage being removed like this in the API examples, eg
but it doesn't seem to work in Python. Has anyone done this successfully? What am I doing wrong?