title: module import: NameError: name is not defined
body: <p>How do I define the function in the importer so that it is visible inside imported? I tried this</p>
  
  <p><code>importer.py</code> is</p>
  
  <pre><code>def build():
      print "building"
  
  build()
  
  import imported
  </code></pre>
  
  <p>Whereby, <code>imported.py</code> is simply</p>
  
  <pre><code>build()
  </code></pre>
  
  <p>Yet, this fails</p>
  
  <pre><code>building
  Traceback (most recent call last):
    File "C:\Users\valentin\Desktop\projects\maxim\miniGP\b01\evaluator\importer.py", line 6, in &lt;module&gt;
      import imported
    File "C:\Users\valentin\Desktop\projects\maxim\miniGP\b01\evaluator\imported.py", line 1, in &lt;module&gt;
      build()
  NameError: name 'build' is not defined
  </code></pre>
  
  <p><strong>Update</strong> After I have got the response to make the circular import, so that import and imported depend on each other, I feel that I need to make clear that this is not always good. My purpose is to specify some common strategy in the imported module. It will use some user-defined functions, e.g. <code>build</code>. User defines the necessary function(s) and calls the strategy. The point is that the shared strategy must not depend on specific user definitions. I believe that in place of <code>import</code>, I need something like <code>evaluate(imported.py)</code>, which I believe is a basic function in any script language, including Python. irc://freenode/python insists that I must use <code>import</code> but I do not understand how.</p>