title: python 2.7 Use inside one function a method of a class, when class instance is in another function
body: <p>This is a an example of the code:</p>
  
  <p><code>module1.py</code> is imported in the main.
  In modul1.py, there is an <code>init()</code> function that creates classes from a previous imported library, and then, other functions uses this instance of the class, and the methods of that class.</p>
  
  <pre><code>ERROR: global name name1  not defined
  </code></pre>
  
  <p><strong>module1.py:</strong></p>
  
  <pre><code>from lib import class1, classs2
  
  def init():
      name1.class1()
  
  
  def function():
      name1.class1method1()
  </code></pre>
  
  <p><strong>main.py:</strong></p>
  
  <pre><code>import module1
  init()
  
  function()
  </code></pre>
  
  <p>I need some help, thanks</p>