title: importlib.import_module ignoring re-exports made in __init__.py
body: <p>(Originally asked on <a href="https://www.reddit.com/r/learnpython/comments/g8psj4/ask_anything_monday_weekly_thread/fp923c0?utm_source=share&amp;utm_medium=web2x" rel="nofollow noreferrer">r/learnpython</a>, but figured I'd ask here too.)</p>
  
  <p>Since this problem came up while dealing with django, I'll explain in that context.</p>
  
  <p>So I have a django project folder, and some internal django apps living in that project folder, like this:</p>
  
  <pre><code>project_module
  ├ apps
  │ ├ app_module1
  │ │ ├ models.py
  │ │ └ ...
  │ ├ app_module2
  │ └ ...
  ├ settings.py
  └ ...
  </code></pre>
  
  <p>now the app_modules are available as <code>project_module.apps.app_module1</code> and so on, but since there won't be anything colliding with the app names in <code>project_module</code>, I'd like to drop the <code>.apps</code> part so I can just refer to them as <code>project_module.app_module1</code> and such, consistently.</p>
  
  <p>So, I create <code>__init__.py</code> everywhere, and put this into <code>project_module/__init__.py</code>:</p>
  
  <pre><code>from .apps import app_module1
  </code></pre>
  
  <p>And this sort of works, since I can <code>import project_module.app_module1</code> and it seems to work.</p>
  
  <p>BUT, Django internally uses <code>importlib.import_module</code> here and there, and in those cases I encounter <code>ModuleNotFoundError: No module named 'project_module.app_module1'</code>. In those cases I can use the <code>.apps</code> again, but this sort of breaks consistency.</p>
  
  <p>A bit of experiment later, I'm convinced <code>import_module</code> ignores re-exports from <code>__init__.py</code>; But why does this happen, and is there a way I can play around this in this case?</p>