While executing a bash subshell inside a Python script I had to inherit the environment variables, that can be done in this way:


*Here you need to restart your shell in order to execute .bashrc and export the variable.




The thing is, if you add new values (aliases / variables) to your bashrc you’ll need to restart your terminal in order to bashrc to get executed and make those changes availables in the environment.

From a subshell process you can’t set environment variables to the parent shell.