Typesheds shadow local modules when imported as from packageA import moduleB
#6988
Labels
needs repro
Issue has not been reproduced yet
from packageA import moduleB
#6988
When importing own modules that have the same name as other modules in the included typeshed fallbacks, the fallbacks are used instead of the local module under certain conditions, causing imports to fail for no apparent reason.
Environment data
Code Snippet
Results in ""import_export_module" is unknown import symbol (reportAttributeAccessIssue)".
Ctrl+Clicking on "import_export" leads to
~/.vscode/extensions/ms-python.vscode-pylance-2025.2.1/dist/typeshed-fallback/stubs/django-import-export/import_export/__init__.pyi
, showing that the language server resolvedimport_export
to a typeshed module. However, this module is not installed and doesn't really clash with the local module definition.It works when changing the code sligthly, e.g. using one of these imports instead:
But since there are a lot of modules for which typesheds exist, and that set is not constant, this isn't really a feasible workaround in general.
The text was updated successfully, but these errors were encountered: