title: How to import recursively all classes in a module?
body: <p>Is it possible to use <code>__all__</code> recursively?
  This imports modules in <code>__all__</code> ...</p>
  
  <pre><code>from mypkg import *
  </code></pre>
  
  <p>but not recursively. </p>
  
  <p>Trying to put everything into <code>__all__</code> (inside <code>__init__.py</code>) doesn't seem to be useful either:</p>
  
  <pre><code>from pathlib import Path
  
  # List all python (.py) files in the current folder and put them as __all__
  fs = [f for f in Path('mypkg/').rglob('*.py') if not f.name.endswith('__init__.py')]
  __all__ = [str(f).replace('/','.')[:-3][5:] for f in fs]
  </code></pre>
  
  <p>Since...</p>
  
  <pre><code>from mypkg import *
  </code></pre>
  
  <p>Results in <code>AttributeError: module 'mypkg' has no attribute 'module1.file1'</code> for the first folder in the package.</p>