0

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?

Çelebi Murat
  • 168
  • 11

1 Answers1

1

Vscode is retrieved with the workspace as the root directory. You can use sys path. append().

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13