Problem
I've been trying to run a python script which imports from the Foundation package:
from Foundation import ...
Whenever I try to run this I get the following error:

Things I've done:
I've installed the Foundation package and verified that it was installed in /usr/local/lib/python3.7/site-packages
I've added export PYTHONPATH='/usr/local/lib/python3.7/site-packages' to my .zshrc file.
When I go into interactive mode, sys.path includes /usr/local/lib/python3.7/site-packages and I can successfully import Foundation:
When I run the script using /usr/local/bin/python3.7, sys.path does not include /usr/local/lib/python3.7/site-packages and importing Foundation fails:
Does anyone know why this might be happening and/or how to fix this? Why does running this script have a different sys.path than running the same python executable in interactive mode?
(I know I could use sys.path.extend(desired path) or something like that but that's not an ideal solution)


sudo. That gets you a different .zshrc; you don't inherit the environment.sudo. It strips out most environment variables.