title: How to use sphinx automodule and exposed functions in __init__
body: <p>I have a folder structure that looks like:</p>
  
  <pre><code>project/
      mymodule/
          __init__.py
          m1.py
          m2.py
          sub1/
              __init__.py
              s1.py
              s2.py
  </code></pre>
  
  <p><code>mymod/__init__.py</code>:</p>
  
  <pre><code>"""The __init__ docstr"""
  from m1 import *
  from m2 import *
  </code></pre>
  
  <p><code>mymod/m1.py</code>:</p>
  
  <pre><code>"""m1 doc str"""
  def func1():
      """func1 docstr"""
      return 1
  </code></pre>
  
  <p><code>mymod/m2.py</code>:</p>
  
  <pre><code>"""m2 doc str"""
  def func2():
      """func2 docstr"""
      return 2
  </code></pre>
  
  <p><code>mymod/sub1/__init__.py</code>:</p>
  
  <pre><code>"""The sub1 __init__ docstr"""
  from s1 import *
  from s2 import *
  </code></pre>
  
  <p><code>mymod/sub1/s1.py</code>:</p>
  
  <pre><code>"""s1 docstr"""
  def sub1():
      """sub1 docstr"""
      return 3
  </code></pre>
  
  <p><code>mymod/sub1/s2.py</code>:</p>
  
  <pre><code>"""s2 docstr"""
  def sub2():
      """sub2 docstr"""
      return 4
  </code></pre>
  
  <p>When I use the module directly it seems to be working as expected:</p>
  
  <pre><code>&gt;&gt;&gt; import mymod
  &gt;&gt;&gt; from mymod import sub1
  &gt;&gt;&gt; mymod.func1()
  1
  &gt;&gt;&gt; sub1.subfunc1()
  3
  &gt;&gt;&gt; mymod.__doc__
  'The __init__ docstr'
  &gt;&gt;&gt; mymod.func1.__doc__
  'func1 docstr'
  </code></pre>
  
  <p>However, when I go to use the automodule in sphinx (after adding the project folder to my sys.path):</p>
  
  <pre><code>.. automodule:: mymod
      :members:
  
  .. automodule:: mymod.sub1
      :members:
  </code></pre>
  
  <p>I get a page with just:</p>
  
  <pre><code>The __init__ docstr
  The sub1 __init__ docstr
  </code></pre>
  
  <p>It seems to be ignoring the <code>from m1 import *</code> type statements...</p>
  
  <p>But, if I copy all of the code directly into the <code>__init__</code> files for each module/sub-module I get:</p>
  
  <pre><code>The __init__ docstr
  
  mymod.func1()
  func1 docstr
  
  mymod.func2()
  func2 docstr
  
  The sub1 __init__ docstr
  
  mymod.sub1.sub1()
  sub1 docstr
  
  mymod.sub1.sub2()
  sub2 docstr
  </code></pre>
  
  <p>Does sphinx <code>automodule</code> not work with modules with these sorts of import statements in the <code>__init__</code> file or am I missing a more obvious issue?</p>
  
  <p>Ideally, I'd like an output like I get when putting all the code in the <strong>init</strong> (put using import statements instead).</p>