title: How to import a module from different directory with Python 3?
body: <p>I've tried to import a module for testing but received this error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "BaseTest.py", line 8, in 
        from .main.pageobjects.FBPage import *
    ModuleNotFoundError: No module named '<strong>main</strong>.main'; '<strong>main</strong>' is not a package</p>
  </blockquote>
  
  <p>the project tree looks like this:</p>
  
  <pre><code>/- ProjectDir
  /- .src
  /- .src.main
  /- .src.main.core
  /- .src.main.core.BaseCode &lt;- base code to be extended as parent
  /- .src.main.core.pageobjects
  /- .src.main.core.pageobjects.Module &lt;- a module that inherit from BaseCode 
  /- .src.tests
  /- .src.tests.BaseTest &lt;- main testing module
  /- .src.tests.results
  </code></pre>
  
  <p>I basically did this inside my BaseTest module:</p>
  
  <pre><code>from .main.pageobjects.Module import *
  </code></pre>
  
  <p>What am I doing here wrong?
   :) </p>