title: Module/Project structure in Python
body: <p>I'm trying to build a simple project in Python,however I can't seem to wrap my head around how it's done despite reading the documentations over and over and reading example code.</p>
  
  <p>I'm semi-new to Python, having a background of only single-file scripting.
  However I made numerous Node.js and Java projects with multiple folders and packages.
  In Python However I can't seem to grasp the project structure and workflow mechanisms- <strong>init</strong>.py, virtualenvs, setuptools etc. it all seems very alien and unintuitive to me, hurting my  overall productivity(ironically Python is supposed to be a language aimed at productivity, right?)</p>
  
  <p>My project has this example structure:</p>
  
  <pre><code>package_test  (package)
      |
      |------- __init__.py
      |------- main.py (entry point)
      |
      |------- /lib (modules)
      |           |
      |           |----- __init__.py
      |           |----- lib.py
      |
      |------- /Tests
      |           |
      |           |----- __init__.py
      |           |----- test.py
  </code></pre>
  
  <p>in main.py:</p>
  
  <pre><code> from lib import lib
  
   lib.libtest()
  </code></pre>
  
  <p>in lib.py:</p>
  
  <pre><code> def libtest():
       print("libtest")
  </code></pre>
  
  <p>in test.py:</p>
  
  <pre><code> from lib import lib
  
   lib.libtest()
  </code></pre>
  
  <p>Running main.py works, However when running test.py it cannot find the module. I have tried solutions such as appending to sys.path, putting '..' before lib, and more- none have worked.</p>
  
  <p>This is just an example, but I wish to develop more complex projects in Python with multiple subfolders in the future(I think Python has some cool features and nice libraries), yet this problem keeps bothering me. I never had to think about these issues when developing in Java or in Node, not to mention stuff such as virtualenv etc.</p>
  
  <p>Thank you in Advance</p>