from pathlib import Path from dotenv import load_dotenv env_path = Path('.', '.env') load_dotenv(dotenv_path=env_path) my_env_var = os.getenv('MY_ENV_VAR')