I have a script that works great as a pre-build process which uses the $PIOENV variable to dynamically select the correct target and such for processing some files before compilation. This works fine as the script is called by the PIO engine which defines the $PIOENV variable before running the build script.
I now have a requirement that I need a python script to be ran (like a tool) by the user but without going through the PIO build process.
My question is:
Is there any way that a python script ran in isolation can “hook” into the running PIO instance and get a reference to the $PIOENV variable?