title: Modules imported twice. Possible bug in Python interpreter
body: <p>I've made a rather contrived import scheme in a project of mine and I think I might have discovered a bug in the Python interpreter that causes modules to be imported twice.</p>
  
  <p>Here's how my test project is set up:</p>
  
  <ul>
  <li><p>/</p>
  
  <ul>
  <li><p><strong>Launcher.bat</strong> &mdash; Project is run from here. It launches 'main/__init__.py` using the Python 3.2 executable</p></li>
  <li><p><strong>main/__init__.py</strong> &mdash; The <code>__main__</code> script, the one launched by 'Launcher.bat'</p></li>
  <li><p><strong>main/foo.py</strong> &mdash; Contains an empty class</p></li>
  <li><p><strong>external/__init__.py</strong> &mdash; A script external to the 'main' project scripts, used to demonstrate the problem </p></li>
  </ul></li>
  </ul>
  
  <p><strong>./Launcher.bat</strong></p>
  
  <pre><code>@echo off
  C:\Python32\python.exe main\__init__.py
  pause
  </code></pre>
  
  <p><strong>./main/__init__.py</strong></p>
  
  <pre><code>from foo import Foo
  print("In 'main', Foo has id:", id(Foo))
  
  # Add the directory from which 'Launcher.bat' was run,
  # which is not the same as the './main' directory
  # in which this script is located
  import sys
  sys.path.insert(1, '.')
  
  
  # This script will try to import class Foo, but in doing so
  # will casue the interpreter to import this './main/__init__.py'
  # script a second time.
  __import__('external')
  </code></pre>
  
  <p><strong>./main/foo.py</strong></p>
  
  <pre><code>class Foo:
      pass
  </code></pre>
  
  <p><strong>./external/__init__.py</strong></p>
  
  <pre><code>from main.foo import Foo
  print("In 'external', Foo has id:", id(Foo))
  </code></pre>
  
  <p>All of this will print the <code>'Main script was imported'</code> message twice. If the external script imports any other scripts, those too will be imported twice. I've only tested this on Python 3.2. Is this a bug, or did I make a mistake?</p>
  
  <p>Output of the program is:</p>
  
  <blockquote>
    <p>In 'main', Foo has id: 12955136<br>
    In 'main', Foo has id: 12955136<br>
    In 'external', Foo has id: 12957456<br>
    Press any key to continue . . . </p>
  </blockquote>