I am trying to update a linux environment variable using a bash script, loaded from a python script
1.- I delete it:
status, output = commands.getstatusoutput('. ' + PATH +'/script.sh')
os.environ is not your environment, but a representation of it, created when the
os module is imported for the first time. According to the documentation some platforms will reflect changes to
os.environ in the process's environment. Since you run a subprocess to change the environment, those changes are made to the subprocess, not to the process in which your Python code runs.
There is no way to have changes to a process's environment reflected in its parent process's environment.