title: Importing a function/class from a Python module of the same name
body: <p>I have a Python package <code>mymodule</code> with a sub-package <code>utils</code> (i.e. a subdirectory which contains modules each with a function). The functions have the same name as the file/module in which they live.</p>
  
  <p>I would like to be able to access the functions as follows,</p>
  
  <p><code>from mymodule.utils import a_function</code></p>
  
  <p>Strangely however, sometimes I can import functions using the above notation, however other times I cannot. I have not been able to work out why though (recently, for example, I renamed a function and the file it was in and reflected this rename in the <code>utils.__init__.py</code> file but it no longer imported as a functions (rather as a module) in one of my scripts.</p>
  
  <p>The <code>utils.__init__.py</code> reads something like,</p>
  
  <pre><code>__all__ = ['a_function', 'b_function' ...]
  from a_function import a_function
  from b_function import b_function
  ...
  </code></pre>
  
  <p><code>mymodule.__init__.py</code> has no reference to <code>utils</code></p>
  
  <p>Ideas?</p>