title: How can I import a package using __import__() when the package name is only known at runtime?
body: <p>I have a messages folder(package) with <code>__init__.py</code> file and another module <code>messages_en.py</code> inside it. In <code>__init__.py</code> if I import <code>messages_en</code> it works, but <code>__import__</code> fails with "ImportError: No module named messages_en"</p>
  
  <pre><code>import messages_en # it works
  messages = __import__('messages_en') # it doesn't ?
  </code></pre>
  
  <p>I used to think 'import x' is just another way of saying <code>__import__('x')</code></p>