Using the serial monitor with two projects in a workspace

I have just started exploring ‘workspace’ as it’s convenient at present to have two projects (which interact with each other over a hardware serial link) open at the same time. I have a couple of questions below:

Question 1
For PC based interactions, one project uses COM12 and the other COM17 as per their respective PIO.ini.

Is there a way to open a serial monitor for COM12, then close it and open one for COM17?

Or perhaps it’s possible to have two serial monitors open simultaneously?

Question 2
When using pyUPDI to upload code when there are two projects in a workspace, how do I ensure the correct code is uploaded to the correct chip? Is there a concept of ‘active project’ in the workspace?

thanks for help.

The to-be-opened COM port when doing a “Monitor” is always determined through the platformio.ini’s monitor_port value, or, if it’s missing, PlatformIO will open the first available COM port that PlatformIO thinks is correct (it will e.g. avoid the motherboard’s hardware serial port and prefer USB-Serial converters as those are usually the dev boards).

Sadly PlatformIO doesn’t allow that when you click on the “monitor” task normally. It will tell you that a monitor task is already running when attempting to open a second one.

A way around that is opening a new CLI and manually executing pio device monitor while another monitor has already been opened. VSCode allows switching between the different terminal session on the lower-right half of the window.

You must always make sure that the right target environment in the right project is selected through the project environment switcher.

thanks for reply, I think the project environment switcher part helps enough, at least I can now get a monitor related to the project that’s active.