Pylance uses long imports instead of short imports

25 Views Asked by At

I defined __all__ in __init__.py to make the imports shorter, but pylance keeps offering the longest imports. How can this be fixed? It only works like this with imports in my project, but not with imports from libraries, there it offers short imports

I have a class in a module, path: my_package.my_module.file

I defined __all__:

from .file import my_class

__all__ = ["my_class"]

Pylance still offers my_package.my_module.file not my_package.my_module

Tried adding extra path. Didn't work. I expect pylance to offer short imports, like when importing from libraries

0

There are 0 best solutions below