title: mypy error: Cannot find implementation or library stub for module
body: <p>I am trying to set MYPYPATH to find a library located in another directory. I am importing a function like this:</p>
  <pre><code>from my_module import my_function
  </code></pre>
  <p>The file structure:</p>
  <pre><code>function
  |__lib1
  |  |__lib2
  |     |__my_module.py
  |__function1
     |__src
        |__index.py  &lt;-- this is the file where my_module is imported
  </code></pre>
  <p>The file structure has to be like this because these are AWS Lambdas (<code>lib1</code> is the Lambda layer here).</p>
  <p>I am using the following tox configuration:</p>
  <pre><code>skipsdist = True
  envlist = mypy
  
  [testenv]
  deps = -r requirements.txt
  
  [testenv:mypy]
  commands = mypy --namespace-packages -p function -p test
  </code></pre>
  <p>I tried setting:</p>
  <p><code>setenv = MYPYPATH = './function/lib1/lib2'</code></p>
  <p><code>setenv = MYPYPATH = './function/lib1/lib2/my_module.py'</code></p>
  <p>as well as</p>
  <p><code>mypy_path = 'function/lib1/lib2'</code></p>
  <p><code>mypy_path = 'function/lib1/lib2/my_module.py'</code></p>
  <p>I tried full path instead of relative path as well.</p>
  <p>However, I'm still getting the same error: <code>error: Cannot find implementation or library stub for module named my_module</code>.</p>
  <p>This is not a tox issue, as running <code>mypy --namespace-packages -p function -p test</code> alone produces the same error.</p>
  <p>Is there a way to make it work?</p>