title: import local package during poetry run
body: <p>I just transitioned from <code>pipenv</code> to <code>poetry</code> and I'm having trouble importing a package from a local package I'm developing in a few of my scripts. To make this more concrete, my project looks something like:</p>
  <pre><code>pyproject.toml
  poetry.lock
  bin/
    myscript.py
  mypackage/
    __init__.py
    lots_of_stuff.py
  </code></pre>
  <p>Within <code>myscript.py</code>, I <code>import mypackage</code>. But when I <code>poetry run bin/myscript.py</code> I get a <code>ModuleNotFoundError</code> because the <code>PYTHONPATH</code> does not include the root of this project. With <code>pipenv</code>, I could solve that by specifying <code>PYTHONPATH=/path/to/project/root</code> in a <code>.env</code> file, which would be automatically loaded at runtime. <strong>What is the right way to import local packages with poetry?</strong></p>
  <p>I ran across this piece on <a href="https://python-poetry.org/docs/configuration/#using-environment-variables" rel="noreferrer">using environment variables</a> but <code>export POETRY_PYTHONPATH=/path/to/roject/root</code> doesn't seem to help.</p>