Usually, you do no import
shell script into python program, those are separate scripting engines, with different grammar, runtime-time conventions and environments.
Common setup include building a 'launcher' script - small wrapper around you 'py`
~/me/dbconnect.sh
source ~/app/environment/env_param.sh
~/me/dbconnect.py ...
Inside ~/me/dbconnect.py
import os ;
...
print(os.environ['username')) ;
Alternative 1:
You can also consider the alternative of converting the env_param.sh to a property file, where each line follows keyword=value format. In this setup, sh scripts can 'source' the param file (assuming no wild card, etc), and python program can parse the file into a a dictionary.
env.param:
user=my-user-id
password=my-pass
Using this solution will only support simple constants.
See: Python: How to create a dictionary from properties file while omitting comments on how to read property file into dictionary.
Alternative 2:
If both options are not practical, consider opening the env_param.sh in python, and looking for lines matching 'export var=value', and loading them into dictionary. The down side is that any extension to the parameter file that will use bash/shell features will not work.