title: Relative imports in Python 3
body: <p>I want to import a function from another file in the same directory.</p>
  <p>Usually, one of the following works:</p>
  <pre><code>from .mymodule import myfunction
  </code></pre>
  <pre><code>from mymodule import myfunction
  </code></pre>
  <p>...but the other one gives me one of these errors:</p>
  <pre class="lang-none prettyprint-override"><code>ImportError: attempted relative import with no known parent package
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>ModuleNotFoundError: No module named 'mymodule'
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>SystemError: Parent module '' not loaded, cannot perform relative import
  </code></pre>
  <p>Why is this?</p>