title: How to import a Python module from a sibling folder?
body: <p>I have gone through many Python relative import questions but I can't understand the issue/get it to work.</p>
  
  <p>My directory structure is:</p>
  
  <pre><code>Driver.py
  
  A/
        Account.py
        __init__.py
  
  B/
        Test.py
        __init__.py
  </code></pre>
  
  <p><code>Driver.py</code></p>
  
  <pre><code>from B import Test
  </code></pre>
  
  <p><code>Account.py</code></p>
  
  <pre><code>class Account:
  def __init__(self):
      self.money = 0
  </code></pre>
  
  <p><code>Test.py</code></p>
  
  <pre><code>from ..A import Account
  </code></pre>
  
  <p>When I try to run:</p>
  
  <pre><code>python Driver.py
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>Traceback (most recent call last):
  
  from B import Test
  
  File "B/Test.py", line 1, in &lt;module&gt; from ..A import Account
  
  ValueError: Attempted relative import beyond toplevel package
  </code></pre>