title: Relative imports in Python
body: <p>Hey all -- I am pulling my hair out with relative imports in Python.  I've read the documentation 30 times and numerous posts here on SO and other forums -- still doesn't seem to work.</p>
  
  <p>My directory structure currently looks like this</p>
  
  <pre><code>src/
      __init__.py
      main.py
      components/
          __init__.py
          expander.py
          language_id.py
      utilities/
          __init__.py
          functions.py
  </code></pre>
  
  <p>I want expander.py and language_id.py to have access to the functions module.  I run python main.py which accesses the modules just fine with from components.expander import * and components.language_id import *.</p>
  
  <p>However, the code inside expander and language_id to access the functions module:</p>
  
  <pre><code>from ..utilities.functions import *
  </code></pre>
  
  <p>I receive this error:</p>
  
  <pre><code>ValueError: Attempted relative import beyond toplevel package
  </code></pre>
  
  <p>I have gone over it a bunch of times and it seems to follow the documentation.  Anyone have any ideas of what's going wrong here?</p>