title: Jython : NameError: global name is not defined
body: <p>I am using Jython to write a code(Hyperion FDMEE/Essbase) wherein external libraries are getting imported explicitly in a function</p>
  
  <pre><code>#FN_RETRIEVE
  import os
  import sys
  sys.path.append("D:\\EssbaseJavaAPI\\11.1.2.0\\lib\\ess_japi.jar")
  def RETRIEVE(fdmAPI, fdmContext, grid_typ):
          ## Import libraries
          from com.essbase.api.session import *
          from com.essbase.api.domain import *
          from java.lang.Object import *
          from com.essbase.api.base import *
          from com.essbase.api.datasource import *
          from com.essbase.api.dataquery import *
          from com.essbase.api.metadata import *
          from com.essbase.api.domain import *
          from com.essbase.api.session.IEssbase import *
          from com.essbase.api.domain.IEssDomain import *
          from array import *
  
  
          config = ConfigParser.ConfigParser()
          config.read("D:/somepath/config.ini")
  
  
          # Create JAPI instance.
          ess = IEssbase.Home.create(IEssbase.JAPI_VERSION) …….
  </code></pre>
  
  <p>Now, I am trying to call this function in a different script as follows</p>
  
  <pre><code>import FN_RETRIEVE
  reload(FN_RETRIEVE)
  
  retr1 = FN_RETRIEVE.RETRIEVE(fdmAPI, fdmContext, "another param")
  </code></pre>
  
  <p>But I am getting the following error,</p>
  
  <pre><code>ess = IEssbase.Home.create(IEssbase.JAPI_VERSION) NameError: global name 'IEssbase' is not defined
  </code></pre>
  
  <p>It probably has to do something with the scope, but need help here what I may be missing.</p>
  
  <p>Thanks,
  Dev</p>