Skip to content

Autocomplete cannot see sibling modules in package #3547

@munael

Description

@munael

Environment data

  • VS Code version: 1.30
  • Extension version (available under the Extensions sidebar): 2018.11
  • OS and version: Windows 10 1803
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 3.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): None
  • Relevant/affected Python packages and their versions: All

Expected behaviour

Auto complete works for packages and modules visible to the current file as to a Python interpreter executing the file from the parent directory of the workspace.

Actual behaviour

No auto complete is offered for 'nested sibling modules' in the root workspace package (__init__.py exists and all). Relative imports are not recognized as a solution either.

Steps to reproduce:

Have something that looks roughly like this:

root/
    main.py
    __init__.py
    tools/
        __init__.py
        tool.py

And in main.py:

import tools.tool
# or
from tools import tool
# or
from .tools import tool
# Any others to try?

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

None

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
Nothing is logged here when I change source files to remove/re-add imports of the sort, so nothing to report.

Metadata

Metadata

Assignees

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions