[Python] Pylance can't resolve the import of a library under same package

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am using VSCode and Pylance. I have the following workspace

    - src
    - company
    - __init__.py
    - team
    - __init__.py
    - project
    - __init__.py
    - A.py
    - B.py


    And I have some libraries that I import in A.py like this

    from company.team import library1


    since my workspace also contains company.team, Pylance tries to find library1 in my workspace.

    If I do the following, pylance looks at the correct place (/lib/python3.8) and it works.

    from company.team.library1 import foo


    I have the correct path for python.autoComplete.extraPaths, so that is not an issue.

    Any help?

    Continue reading...

Compartilhe esta Página