title: How to import from the __init__.py in the same directory?
body: <p>Suppose I have a module <code>rules</code> with the following structure:</p>
  
  <pre><code>rules
  ├── conditions.py
  ├── __init__.py
  </code></pre>
  
  <p>In the script <code>conditions.py</code>, I'd like to import a class called <code>RuleParserError</code> defined in <code>__init__.py</code>. However, I haven't been able to figure out how to do this. (Following <a href="https://stackoverflow.com/questions/22282316/python-how-to-import-from-an-init-py-file">Python: How to import from an __init__.py file?</a> I've tried</p>
  
  <pre><code>from . import RuleParserError
  </code></pre>
  
  <p>but this leads to an <code>ImportError: cannot import name RuleParserError</code> when trying to run <code>conditions.py</code> as <code>__main__</code>).</p>