title: Open Maya callBacks in Python or C++ query all callbacks in Memory
body: <p><strong>Hello, I'm wondering if there is a way to query all **User Created</strong> <code>callbacks</code> in <strong>Maya</strong>?, 
  And in the same way, if I can query what objects or nodes are connected to them. I want to manage better the cleanliness in the memory at every time and not let any callback lost in memory.**</p>
  
  <pre><code>import maya.cmds as cmds
  import maya.OpenMaya as OpenMaya
  ##########################################
  class MayaSignals(object):
      def __init__(self):
          super(MayaSignals)       
          self.callback_list = []
  
      def setCallback(self, node):
          sel = OpenMaya.MSelectionList()
          sel.add(node)
          obj = OpenMaya.MObject()
          sel.getDependNode(0, obj)       
          idx = OpenMaya.MNodeMessage.addAttributeChangedCallback(obj, self.reading_node)
          self.callback_list.append(idx)
  
      def removeAllCallback(self):
          for idx,itm in enumerate(self.callback_list):
              print(idx, 'removed')
              OpenMaya.MMessage.removeCallback(itm)
  
      def reading_node(self, msg, plug, otherplug, *clientData):
          if msg &amp; OpenMaya.MNodeMessage.kAttributeSet:
              print ('Attribute Changed On: %s' % plug.name())
          if msg &amp; OpenMaya.MNodeMessage.kConnectionMade:
              print('Connection Created On: %s' % plug.name()) 
          if msg &amp; maya.OpenMaya.MNodeMessage.kConnectionBroken:
              print ("Broken Connection On: %s" % plug.name())
  
  ################################################################################################        
  node = cmds.ls(sl=True)[0]         #&lt; ------ Node string type
  
  #signal = MayaSignals()            # class to manage the callbacks
  #signal.setCallback(node)
  signal # # #                       # to keep the instance alive
  signal.removeAllCallback()         # remove all into the array 
  
  
  # ---------------------------------------------`-`---------------------------------------------- #
  </code></pre>
  
  <p>Here, I created an example where I tag an object to a callback, and print something when some conditions happen, also. add to array every callback ID to delete it later.</p>
  
  <p>I just need a light, even if is in <strong>C++</strong> I could check on the docs about the recommendations here.</p>