I've seen various posts on refreshing powershell and cmd terminals, but I'm not sure if there is also a means to update the environment variables of an already running process (outside of restarting it) that's not either powershell or cmd. These posts were all fairly helpful in helping me understand how things work behind the scenes:
https://superuser.com/questions/130029/refresh-environment-variable
https://www.michaelmiklis.de/update-environment-variables-in-current-process/
And this post (same question but in relation to linux) seems to indicate there is a means in linux:
Changing environment variable of a running process
I'm curious if theres a similar method in Windows. My assumption is no, you have to restart, but I can't find an explicit no. Why I'd like to do this is because I'm working on a system that tests hardware. The top level tool is a sequencer that's capable of calling various code modules (python, .net, .exes, etc). From within the this top level tool, I'm calling a python module that expects a specific environment variable be set. However, I won't know what this variable should be until a bar code is scanned. I've written C# code that can set an environment variable, and check if one is set, but since the top level process hasn't been made aware of the change it's not really possible for the python module to have the correct variable value unless it's somehow known before everything is started.