title: How to accomplish relative import in python
body: <pre><code>stuff/
      __init__.py
      mylib.py
      Foo/
          __init__.py
          main.py
          foo/
              __init__.py
              script.py
  </code></pre>
  
  <p><code>script.py</code> wants to import <code>mylib.py</code></p>
  
  <p>This is just an example, but really I just want to do a relative import of a module in a parent directory. I've tried various things and get this error...</p>
  
  <p><code>Attempted relative import beyond toplevel package</code></p>
  
  <p>I read somewhere that the script from where the program starts shouldn't in the package, and I tried modifying the structure for that like so...</p>
  
  <pre><code>stuff/
      mylib.py
      foo.py // equivalent of main.py in above
      foo/
          __init__.py
          script.py
  </code></pre>
  
  <p>but got same error.</p>
  
  <p>How can I accomplish this? Is this even an adequate approach?</p>
  
  <p>Edit: In Python 2</p>