title: How to automatically execute python script when Maya first loaded
body: <p>I am trying to figure out how to use Python in Maya. I wanted to create a shelf in Maya and when I click that shelf, it will execute a file containing python code.</p>
  
  <p>First thing, I figured out that we can't simply <code>source</code> python script. I followed <a href="http://www.rtrowbridge.com/blog/2008/11/maya-python-import-scripts/" rel="nofollow noreferrer">this</a> tutorial, so now I have a function <code>psource()</code>. In my shelf, I can just call <code>psource("myPythonScript")</code></p>
  
  <p>My problem is I have to somehow register <code>psource()</code> when Maya first loaded.</p>
  
  <p>Any idea how to do this?</p>