Dev.to
8/5/2026

My Algorithmic Trading Bot Silently Failed to Notify: The Curious Case of Missing `.env` Loads Across Scripts
Short summary
A developer discovered that Discord notifications in their algorithmic trading bot were silently failing because executor.py was missing a load_dotenv() call that planner.py had. When run independently, executor.py couldn't find the webhook URL, causing notifications to silently fail—a dangerous scenario for a system handling real money. The fix was adding load_dotenv(find_dotenv()) to executor.py before notification calls.
- •Trading bot's Discord notifications silently failed due to missing load_dotenv() in executor.py
- •Implicit dependency on planner.py loading .env first caused silent failures when scripts ran independently
- •Fix: add load_dotenv(find_dotenv()) to every script that needs environment variables
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



