title: script for automatically loading reference files from different destinations in Maya
body: <p>Hi a beginner in writing python scripts for Maya. I am trying to write a script that automates the process of opening a Maya file along with its references. Usually when the parent file and reference files are in different destinations Maya cannot open a file being referenced and you have to browse the filename to open it. I am trying to automate this. When a user tries to open a file it should open with all its references. So far I have got this but the main part is what I am confused about.</p>
  
  <pre><code>import pymel.api as api
  
  def callFunc():
      print "hello world" # just a print cmd to check
  
  print "registering a file reference call back"
  cb = api.MSceneMessage_addCallback(api.MSceneMessage.kAfterOpen, callFunc())
  
  def callbackOff():
      api.MSceneMessage.removeCallback(cb)
  </code></pre>
  
  <p>So when the function callFunc() is called, this is where all the action happens. Now I don't know how to proceed.  </p>