title: How to select import object name from another function
body: <p>EDIT: I have managed to solved the issue I wa having previously but instead of me creating another new question, this issue I have encountered are pretty much similar I guess?</p>
  
  <p>As I am modifying some of the contents of this script that I am currently doingn, it will boot up this UI whenever user imports in a <code>.chan</code> object</p>
  
  <p>Currently I am trying to edit the camera name such that when users selects the camera, it will inherits the name of the imported camera into its namespace.
  Though I am not very sure, I think the <code>reader</code> function in the <code>customNodeTranslator</code> class is the one that reads the imported camera?</p>
  
  <p>This is the error messgae:</p>
  
  <pre><code># Error: global name 'cameraName' is not defined
  # Traceback (most recent call last):
  #   File "/user_data/scripts/test/maya/plugins/chan.py", line 210, in readFileIn
  #     self.importTheChan = ChanFileImporter(chanRotationOrder)
  #   File "/user_data/scripts/test/maya/plugins/chan.py", line 286, in __init__
  #     self.cameraName = cameraName
  # NameError: global name 'cameraName' is not defined # 
  </code></pre>
  
  <p>This is the original code:</p>
  
  <pre><code>class customNodeTranslator(OpenMayaMPx.MPxFileTranslator):
      ...    
      ...
      ...
  
      def reader(self, fileObject, optionString, accessMode):
          self.initialWindow()
  
          try:
              fullName = fileObject.fullName()
              print "&gt;&gt;&gt; full Name is %s" %fullName
  
              #self.fileHandle = open(fullName,"r")
              camHandle = open(fullName,"r")
              camPath = os.path.basename(camHandle.name)
              camName = os.path.splitext(camPath)[0]
              print "&gt;&gt;&gt; This is the name: %s" % camName
  
          except:
              sys.stderr.write( "Failed to read file information\n")
              raise
  
          return camName
  
  class chanImport():
      """ importing chan camera from nuke """
      def __init__(self, rotation):
          self.rotation = rotationOrder
          # create the camera
          self.cameraName = cmds.camera(n=str(camName))
          self.cameraShape = self.cameraName[1]
  
          cmds.select(self.cameraShape)
          cmds.scale(0.5, 0.5, 0.5)
  </code></pre>
  
  <p>The following code is the actual code itself before I modified:</p>
  
  <pre><code> class customNodeTranslator(OpenMayaMPx.MPxFileTranslator):
      ...    
      ...
      ...
      def writer( self, fileObject, optionString, accessMode ):
          try:
              fullName = fileObject.fullName()
              fileHandle = open(fullName,"w")
  
              selectList = OpenMaya.MSelectionList()
  
              OpenMaya.MGlobal.getActiveSelectionList(selectList)
              node = OpenMaya.MObject()
              depFn = OpenMaya.MFnDependencyNode()
              path = OpenMaya.MDagPath()
              iterator = OpenMaya.MItSelectionList(selectList)
  
                  animationTime = OpenMayaAnim.MAnimControl()
      class ChanFileImporter():
          def __init__(self, rotationOrder):
              self.rotationOrder = rotationOrder
              # create the camera
              self.cameraName = cmds.camera()
              self.cameraShape = self.cameraName[1]
              cmds.select(self.cameraShape)
              cmds.scale(0.5, 0.5, 0.5)
  </code></pre>