Nov. 26, 2020
7:22 a.m.
I know what your getting at, this will work if you want to have variables in the included file in scope in the caller of 'include', just insert it as normal python. Though I prefer this version as it is simpler and less error prone. with open('myfile.py') as f: exec(f.read()) Basically, it includes the file and keep the scope of all variables that came before this type of include statement. Very useful for this like a shared authentication file across an entire website of multiple files/pages. Happy Thanksgiving!