title: NameError: name '__main__' is not defined
body: <p>I have been reading here, but I couldnt find any solution online to solve my problem..I think I have the indentation right, but I still get the Name Error..Can someone help me out please. 
  This script should run a new panel in maya, which works kind of, but the error is really annoying. </p>
  
  <pre><code>class PanelWindow( object ):
      def __init__( self, name, title, namespace=__name__ ):
          self.__name__ = name
          self._title = title
          self.instance = str(namespace) + '.' + self.__name__
  
          if not pm.scriptedPanelType(self.__name__, q = True, ex = True):
              pm.scriptedPanelType(self.__name__, u = True)
  
          jobCmd = 'python(\\\"%s._setup()\\\")' % self.instance
          job = "scriptJob -replacePrevious -parent \"%s\" -event \"SceneOpened\" \"%s\";" % ( self.__name__, jobCmd )
          mel.eval(job)
  
          pm.scriptedPanelType( self.__name__, e = True,
                         unique=True,
                         createCallback = 'python("%s._createCallback()")' % self.instance,
                         initCallback = 'python("%s._initCallback()"  )' % self.instance,
                         addCallback = 'python("%s._addCallback()"   )' % self.instance,
                         removeCallback = 'python("%s._removeCallback()")' % self.instance,
                         deleteCallback = 'python("%s._deleteCallback()")' % self.instance,
                         saveStateCallback = 'python("%s._deleteCallback()")' % self.instance
                          )
  
  
      def _setup(self):
          """Command to be call for new scene"""
          panelName = pm.sceneUIReplacement( getNextScriptedPanel=(self.__name__, self._title) )
          if panelName == '':
              try:
                  panelName = pm.scriptedPanel( mbv=1, unParent=True, type=self.__name__, label=self._title )
              except:
                  pass
          else:
              try:
                  label = panel( self.__name__, query=True, label=True )
                  pm.scriptedPanel( self.__name__, edit=True,  label=self._title )
              except:
                  pass
      def _addCallback(self):
          """Create UI and parent any editors."""
          print 'ADD CALLBACK'
      def show( self ):        
          mel.eval('tearOffPanel "%s" %s true;' % (self._title, self.__name__) )
  
  
  global test
  test = PanelWindow('myName', 'Light')
  
  test.show()
  
  
  # NameError: name '__main__' is not defined # 
  # Error: line 1: name '__main__' is not defined
  # Traceback (most recent call last):
  #   File "&lt;maya console&gt;", line 1, in &lt;module&gt;
  # NameError: name '__main__' is not defined # 
  </code></pre>