title: How do I reference my Azure function from pytest?
body: <p>I'm using Python 3.8 with Azure functions.  I have the following project layout ...</p>
  <pre><code>myproject
      __app__
          __init__.py
          objects
              __init__.py
      tests
          __init__.py
          functions
              __init__.py
              objects
                  __init__.py
                  test_objects.py
  </code></pre>
  <p>My <strong>app</strong>/objects/<strong>init</strong>.py file starts like this ...</p>
  <pre><code>import azure.functions as func
  
  def main(req: func.HttpRequest) -&gt; func.HttpResponse:
      &quot;&quot;&quot;.&quot;&quot;&quot;
      ...
  </code></pre>
  <p>And then my tests/functions/objects/<strong>init</strong>.py looks like</p>
  <pre><code>import pytest
  import azure.functions as func
  
  _import = __import__('__app__/objects')
  
  def test_objects():
      ...
      
  </code></pre>
  <p>However, when I run</p>
  <pre><code>pytest tests/functions/test_objects.py 
  </code></pre>
  <p>I get the error</p>
  <pre><code>tests/functions/test_objects.py:8: in &lt;module&gt;
      _import = __import__('__app__/objects')
  E   ModuleNotFoundError: No module named '__app__/objects'
  </code></pre>
  <p>What's the right way to reference my function?  I also tried just &quot;objects&quot;, but that results in the same ModuleNotFoundError.</p>