#VS Code: How do I manage multiple projects/folders in my workspace?

1 messages · Page 1 of 1 (latest)

prisma sparrow
#

Hi, I am quiet new to VS Code, coding in general and trying to learn python at the moment.

I have 2 folders/projects in my workspace with basically the same files in them, the second folder is a copy of the first, which I am using to test changes, to integrate into the first when the changes are working fine.

Both folders have a main.py and a config.json file which I am reading and writing to with main.py.

Now I encountered the problem that running my main.py from the second folder, the program is reading the config.json file from the first folder.

I am guessing it has something to do with the working directory of the shell/terminal being used to run python?
I watched some videos and asked ChatGPT to explain but I can't wrap my head around it.

I would like to work on multiple projects in the same workspace, duplicating folders and do tests with the copies.
How do I set this up? Do I need to open multiple Shells or Terminals?

Would really appreciate some advice!

supple nebula
#

you should use git branches for that,
but if you really want to use only VSCode open 2 VSCode windows and in each window open separate workspaces in one for main and in other for copy,
eventually in one window open 2 terminals with different current folders and run your code from terminal not from GUI
or more advanced if you want to use GUI to run make your own run tasks and give each one different CWD

prisma sparrow
#

Thank you, I am going to try it different terminals and running from there for now.
Gonna explore creating run tasks as well!

#

🙏

prisma sparrow
#

Just wanted to add, it was quiet simple.

I created a launch.json and added:

"cwd": "C:\Path\workspace\folder\subfolder\${relativeFileDirname}"

the launch.json is located in "folder" and now every run+debug in each subfolder works seperately 🙂