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

Bashrc

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

Bash

Python

Output:

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.