SOLVED - Call a Keyboard Maestro variable in python running in 'Execute Shell Script'?

Python accesses environment variables through the environ dictionary in the os library. So your script needs to include

import os

to import the library. Most people put their import statements up near the top of the script. Then you access the value of fName this way:

with open(os.environ["KMVAR_fName"]) as f:
2 Likes