title: Execute a python file from different directory
body: <p>I try to understand how to split up python files belonging to the same project in different directories. If I understood it right I need to use packages as described <a href="https://docs.python.org/3/tutorial/modules.html#packages" rel="nofollow noreferrer">here in the documentation</a>.</p>
  
  <p>So my structure looks like this:</p>
  
  <pre><code>.
  ├── A
  │   ├── fileA.py
  │   └── __init__.py
  ├── B
  │   ├── fileB.py
  │   └── __init__.py
  └── __init__.py
  </code></pre>
  
  <p>with empty <code>__init__.py</code> files and </p>
  
  <pre><code>$ cat A/fileA.py 
  def funA():
      print("hello from A")
  
  $ cat B/fileB.py 
  from A.fileA import funA
  
  if __name__ == "__main__":
      funA()
  </code></pre>
  
  <p>Now I expect that when I execute <code>B/fileB.py</code> I get <code>"Hello from A"</code>, but instead I get the following error:</p>
  
  <pre><code>ModuleNotFoundError: No module named 'A'
  </code></pre>
  
  <p>What am I doing wrong?</p>