title: Flask current directory
body: <p>I want to easily reference same-directory templates from arbitrary locations in a flask app, for example:</p>
  
  <pre><code>.
  ├── app.py
  ├── src
  │   └── thing
  │       ├── __init__.py
  │       ├── component.html
  │       └── component.py
  └── templates
  </code></pre>
  
  <p>Normally, I would have to <code>render_template</code> referencing the <code>templates</code> directory and go from there, but this is a pain. How can call the same-directory template consistently with a filepath from something like <code>component.py</code>, i.e. something like</p>
  
  <p>in <code>component.py</code></p>
  
  <p><code>return render_template(self.this_files_directory + "/component.html", data=data)</code></p>
  
  <p>How can I do this?</p>