title: Module Not Found Error: No module named 'src'
body: <p>Whenever I run main.py script in terminal error 'ModuleNotFoundError: No module named 'src' ' occurs. However it runs fine in PyCharm.</p>
  
  <p>Project Structure:</p>
  
  <pre><code>-project
    -resources
    -src
      -package1
        -script1.py
        -script2.py
      -package2
        -script3.py
      -main.py
  </code></pre>
  
  <p>From terminal I run like this -</p>
  
  <pre><code>project$ python src/main.py
  </code></pre>
  
  <p><strong>Error I am getting:</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "src/main.py", line 1, in &lt;module&gt;
      from src.package1 import script1
  ModuleNotFoundError: No module named 'src'
  </code></pre>
  
  <p>I have already tried adding absolute path of folder/package 'src' to sys.path</p>
  
  <pre><code>main.py
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>from src.package1 import script1
  from src.package1 import script2
  from src.package2 import script3
  
  if name=="__main__":
    ...
    ...
  </code></pre>
  
  <pre><code>sys.path
  
  current sys.path is ['/home/xyz/Projects/project/src', '/home/xyz/Apps/anaconda3/envs/project/lib/python37.zip', '/home/xyz/Apps/anaconda3/envs/project/lib/python3.7', '/home/xyz/Apps/anaconda3/envs/project/lib/python3.7/lib-dynload', '/home/xyz/Apps/anaconda3/envs/project/lib/python3.7/site-packages', 'src/main.py']
  </code></pre>