title: Call a function in main file from module using python
body: <p>I am trying to make a python script that works so:</p>
  
  <p>I've got a main file that import another file, which is a class with functions inside it.
  The main file calls a function in the module, here it works all well, but when the def inside the module calls another def in the main again, I get an error.</p>
  
  <p>For example, in main.py I've got this</p>
  
  <pre><code>from module import *
  module = Example()
  
  def foo():
   module.foo2()
  
  def foo3():
   print "here is the problem"
  
  if(__name__ == "__main__"):
   foo()
  </code></pre>
  
  <p>In module.py I've got:</p>
  
  <pre><code>class Example():
   def foo2(self):
    foo3()
  </code></pre>
  
  <p>foo2 is called perfectly, but when I try to call foo3() I get a NameError (global name 'foo3' is not defined). I know I should import it somehow but I don't know how to do it.</p>
  
  <p>Last thing: I am quite new to python so please explain good :-)
  Thanks  </p>