title: Python: include library folder when running from command line
body: <p>I have a directory structure:</p>
  
  <pre><code>root_dir
   ├── src
   │   └── p1.py
   └── lib
       ├── __init__.py
       ├── util1.py
       └── util2.py
  </code></pre>
  
  <p>I want to run <code>src/p1.py</code> which uses <code>lib/util1.py</code> using an import statement <code>import lib.util1 as u1</code>.</p>
  
  <p>It runs fine when I use PyCharm, but I want to also run it from command line. How can I run the program from command line?</p>
  
  <p>I have tried <code>cd root_dir</code> then <code>python src/p1.py</code>.</p>
  
  <p>But it produces the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./src/p1.py", line 1, in &lt;module&gt;
      import lib.util1 as u1
  ImportError: No module named lib.util1
  </code></pre>
  
  <p>How can I run the python program <code>src/p1.py</code> from the command line?</p>
  
  <p>Edit: Based on the suggestion from @Sumedh Junghare, in comments, I have added <code>__init__.py</code> in lib folder. But still it produces the same error!</p>