title: Modules imported upon class intiation can't be used by methods
body: <p>I've created a class that import some modules upon intiation and then these modules are used in some class methods. When I call the modules in a method, I get a NameError that these models are not defined</p>
  
  <pre><code>class Paper(object):
      '''
      analyse a paper and extract parts of it
      '''
      def __init__(self, paper_path):
  
          #import needed modules
          needed_modules = ['io', 'pdfminer', 'pickle', 're', 'string', 'os']
          import io, pickle, re, string, os
  
          from pdfminer.converter import TextConverter as TC
          from pdfminer.pdfinterp import PDFPageInterpreter as PInt
          from pdfminer.pdfinterp import PDFResourceManager as RM
          from pdfminer.pdfpage import PDFPage as Page
          from pdfminer.layout import LAParams as LAP
  
          self._pPath = paper_path
  
  
      def get_text(self):
          res_manager = RM()
          fake_file_handle = io.StringIO()
          codec = 'utf-8'
          laparams = LAP()
          converter = TextConverter(res_manager,
          fake_file_handle,codec=codec, laparams=laparams)
          page_interpreter = PInt(res_manager, converter)
  
          with open(self._pPath, 'rb') as fh:
              for page in Page.get_pages(fh,
                                            caching=True,
                                            check_extractable=True):
                  page_interpreter.process_page(page)
  
              text = fake_file_handle.getvalue()
  
          # close open handles
          converter.close()
          fake_file_handle.close()
  
          if text:
              return text
  </code></pre>
  
  <p>When a run this code:</p>
  
  <pre><code>pPath = 'path'
  
  item = Paper(pPath)
  print(len(item.get_text()))
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>NameError: name 'RM' is not defined
  </code></pre>