Let’s say I have a file foo.py, and within the file I want to execute a file bar.py. But, bar.py isn’t in the same directory as foo.py, it’s in a subdirectory call baz. Will execfile work? What about os.system?
Let’s say I have a file foo.py, and within the file I want to
Share
Just add an empty
__init__.pyfile to signalbazis a module and, fromfoo.pydo:Unless, of course, you have a good reason not to make
bazinto a module (and use execfile).