title: Python3.6 error: ModuleNotFoundError: No module named 'src'
body: <p>I know similar questions have been asked before... But I had a quick doubt...
  I have been following this link: <a href="https://www.python-course.eu/python3_packages.php" rel="nofollow noreferrer">https://www.python-course.eu/python3_packages.php</a></p>
  <p>my code structure:</p>
  <pre><code>my-project
    -- __init__.py
    -- src
        -- __init__.py
        -- file1.py
    -- test
        -- __init__.py
        -- test_file1.py
  </code></pre>
  <p>test_file1.py:</p>
  <pre><code>import unittest
  from src.file1 import *
  
  class TestWriteDataBRToOS(unittest.TestCase):
      def test_getData(self):
      sampleData = classInFile1()
      sampleData.getData()
      self.assertNotEqual(sampleData.usrname, &quot;&quot;)
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  <p>Here I get the error:</p>
  <pre><code>ModuleNotFoundError: No module named 'src'
  </code></pre>
  <p>If I change to :</p>
  <pre><code>import sys
  sys.path.insert(0, '../src')
  import unittest
  from file1 import *
  </code></pre>
  <p>then it works!</p>
  <p>Can someone help me understand why it won't work like how it has been described in the link pasted above or any alternative way instead of writing the <code>sys.path.insert(0, '../src')</code> statement.</p>
  <p>Thanks!</p>
  <p>Edit:</p>
  <p>after executing from my-project dir: <code>python -m unittest test/test_file1/TestWriteDataBRToOS</code> I am getting the error as updated below.</p>
  <pre><code>Traceback (most recent call last):
  File &quot;/usr/lib/python2.7/runpy.py&quot;, line 174, in _run_module_as_main
  &quot;__main__&quot;, fname, loader, pkg_name)
  File &quot;/usr/lib/python2.7/runpy.py&quot;, line 72, in _run_code
  exec code in run_globals
  File &quot;/usr/lib/python2.7/unittest/__main__.py&quot;, line 12, in &lt;module&gt;
  main(module=None)
  File &quot;/usr/lib/python2.7/unittest/main.py&quot;, line 94, in __init__
  self.parseArgs(argv)
  File &quot;/usr/lib/python2.7/unittest/main.py&quot;, line 149, in parseArgs
  self.createTests()
  File &quot;/usr/lib/python2.7/unittest/main.py&quot;, line 158, in createTests
  self.module)
  File &quot;/usr/lib/python2.7/unittest/loader.py&quot;, line 130, in loadTestsFromNames
  suites = [self.loadTestsFromName(name, module) for name in names]
  File &quot;/usr/lib/python2.7/unittest/loader.py&quot;, line 91, in loadTestsFromName
  module = __import__('.'.join(parts_copy))
  ImportError: Import by filename is not supported.
  </code></pre>