title: Maya callback when renderLayer's renderable attribute changed
body: <p>I'm looking to create an OpenMaya callback when the specific attribute &quot;renderable&quot; is changed on an render layer in the scene. I tried this:</p>
  <pre><code>import os
  import time
  from maya import cmds, OpenMaya as om
  
  dag_path = om.MDagPath()
  selection = om.MSelectionList()
  selection.add(&quot;defaultRenderLayer&quot;)
  selection.getDagPath(0, dag_path)
  m_obj = dag_path.node()
  
  def callback(message_type, plug, other_plug, client_data):
      if not message_type &amp; om.MNodeMessage.kAttributeSet:
          return
  
      if &quot;renderable&quot; in plug.name():
          print(&quot;renderable changed!&quot;)
  
  job = om.MNodeMessage.addAttributeChangedCallback(m_obj, callback)
  </code></pre>
  <p>But Maya spits out an error on &quot;selection.getDagPath(0, dag_path).
  I am not experienced using OpenMaya or callbacks, but I would appreciate any help I can get.</p>