You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a local project, when a symbol is defined in a private module (prefixed with _) and re-exported in a public module, Pylance's auto-import feature suggests importing from the private module instead of the public interface.
Reproduction Steps
Here's a minimal project structure to reproduce the issue:
my_package/
├── __init__.py
└── _private.py
With the following content:
my_package/_private.py
classMyClass:
defhello(self):
return"Hello from MyClass"
my_package/__init__.py
from .publicimportMyClass__all__= ["MyClass"]
Expected Behavior
When typing MyClass in a new file outside the package, Pylance should suggest:
frommy_packageimportMyClass
Actual Behavior
Instead, Pylance suggests:
frommy_package._privateimportMyClass
Environment
VS Code version: 1.97
Pylance version: 2025.2.1
The text was updated successfully, but these errors were encountered:
Description
For a local project, when a symbol is defined in a private module (prefixed with
_
) and re-exported in a public module, Pylance's auto-import feature suggests importing from the private module instead of the public interface.Reproduction Steps
Here's a minimal project structure to reproduce the issue:
With the following content:
my_package/_private.py
my_package/__init__.py
Expected Behavior
When typing
MyClass
in a new file outside the package, Pylance should suggest:Actual Behavior
Instead, Pylance suggests:
Environment
The text was updated successfully, but these errors were encountered: