Pylance does not see stub files

184 views Asked by At

I have the following structure:

mypackage/
├─ subpackage/
│  ├─ __init__.py
│  ├─ module.py
│  ├─ module.pyi
├─ __init__.py

File mudule.pyi contains:

class Apple:
    tree: Tree

class Tree:
    apples: Apple

No errors so far. File module.py contains:

class Apple:
    def __init__(self, tree: Tree):
        pass

class Tree:
    def __init__(self, apples: Apple):
        pass

And here the following error is reported by Pylance, saying the name 'Tree' is undefined (also by pyflakes) Name 'Tree' undefined Is there a way to tell Pylance there is stub file or maybe I must put stub file in another place? Problem2

0

There are 0 answers