title: Calling a function from inside a sub-package the correct way in python
body: <p>I have been trying to understand how to properly call a function from inside a subpackage in python. I wanted to be able to call the function the way I call, for example, function <code>isfile</code> from <code>os</code> package, with <code>os.path.isfile()</code>. I made a test package with a structure like this:</p>
  
  <pre><code>sandbox/
      -- __init__.py
      -- acid.py
      -- pack1/
          -- __init__.py
          -- fly/
              -- __init__.py
              -- plane.py
          -- by/
      -- pack2/
  </code></pre>
  
  <p>There are only two modules there, <code>acid.py</code> and <code>plane.py</code>. Both of them contain just a function, e.g. <code>plane.py</code> is</p>
  
  <pre><code>"""plane module"""
  def plane(x):
      x=x+4
      return x
  </code></pre>
  
  <p>To use the function in my test.py code, I put </p>
  
  <pre><code>import pack1
  </code></pre>
  
  <p>in <code>sandbox/__init__.py</code></p>
  
  <pre><code>import fly 
  </code></pre>
  
  <p>in <code>sandbox/pack1/__init__.py</code>, and</p>
  
  <pre><code>from plane import plane
  </code></pre>
  
  <p>in <code>sandbox/pack1/fly/__init__.py</code></p>
  
  <p>The test code was then:</p>
  
  <pre><code>import sandbox
  print sandbox.pack1.fly.plane(3)
  </code></pre>
  
  <p>Is this the right way to import a function from a subpackage, or I'm misunderstanding things?</p>