title: Python relative __import__
body: <p>Suppose I have a module package containing the following files. An empty file <code>C:\codes\package\__init__.py</code> and some non-trivial files:</p>
  
  <p>One located in <code>C:\codes\package\first.py</code></p>
  
  <pre><code>def f():
      print 'a'
  </code></pre>
  
  <p>Another located in <code>C:\codes\package\second.py</code></p>
  
  <pre><code>def f():
      print 'b'
  </code></pre>
  
  <p>There is also a third file: <code>C:\codes\package\general.py</code> with the following code</p>
  
  <pre><code>def myPrint(module_name):
      module = __import__(module_name)
      module.f()
  
  if __name__ == '__main__':
      myPrint('first')
      myPrint('second')
  </code></pre>
  
  <p>When I run the latter file, everything goes fine. However, if I try to execute the file <code>C:\codes\test.py</code> containing</p>
  
  <pre><code>if __name__ == '__main__':
      from package import general
      general.myPrint('first')
      general.myPrint('second')
  </code></pre>
  
  <p>I get the import error <code>ImportError: No module named first</code>. How to resolve this issue?</p>