Environment variables are, by definition, bound to a certain process. If you spawn a child process, it inherits the environment. So, if you want your changes to stay available you need to run the process in the same environment as the one you changed.