PlatformIO Community

Python script to close and open Serial Monitor?

Is it possible to do that in the custom Python script?

I have been using the board reset script that maxgerhardt posted a while ago, and it is very helpful but one inconvenience is that the script fails when there already is an opened Serial Monitor, which is usually the case, and after the reset, I have to open the Serial Monitor manually to see the output. It would be a lot more convenient, if I could add some code to the script so that it automatically closes Serial Monitor before resetting and opens Serial Monitor after resetting.