[Python] Editing two dependent Python projects simultaneously using Visual Studio Code

Discussão em 'Python' iniciado por Stack, Março 27, 2025.

  1. Stack

    Stack Membro Participativo

    I have a project mylib (a Python library) and a project myapp (an application that uses mylib). The two code bases live in unrelated directories. I'm trying to find a setup by which I can edit code in both simultaneously with support from Visual Studio Code.

    My plan had been:

    • create a single Visual Studio Code workspace
    • add the root directories of both projects to that workspace
    • create a venv somewhere else
    • venv/bin/pip install -e both projects into that venv
    • select the python interpreter from the venv on the workspace level in Visual Studio Code.

    However, Visual Studio Code shows the wiggly lines for symbols from the library that are used in the application, saying the imports cannot be found. When I run venv/bin/python, it can import the library symbols just fine.

    Two questions:

    1. Why can't Visual Studio Code import the packages that the venv's python can?
    2. More importantly: what's a good setup for editing two projects simultaneously using Visual Studio Code, I am not stuck on what I tried ...

    Continue reading...

Compartilhe esta Página