title: How to import app file into test file in different directory Python
body: <p>apologies if I'm going about this wrong, but I am quite new to python and can't quite figure out what the problem is! I have a simple Flask app that I'm trying to write tests using pytest for. The file structure is like this:</p>
  <pre><code>│── app.py
  |── tests
  │   ├── tests_app.py
  </code></pre>
  <p>I originally had app.py and tests_app.py in the same level and it all worked fine with tests passing, but now I have put tests in their own folder I can no longer import app without error.</p>
  <p>I have tried the following in tests_app.py:</p>
  <pre><code>from app import app #this is what worked fine when app and tests were in the same folder
  from ..app import app
  from .. import app
  </code></pre>
  <p>and the linting error is 'Attempted relative import beyond top-level package' and when I run pytest it says 'ImportError: attempted relative import with no known parent package'.</p>
  <p>Many thanks in advance!</p>
  <p>p.s. I am using Python 3.8.5</p>