Closed wwdok closed 2 years ago
There's no magic across interpreters. install()
basically adds op
to builtins
so that it could be used in the SAME interpreter process elsewhere. In this case, in the temp2.py
, you need to import temp1
so the install()
executes before you try to use op
. The feature saves you some import
s when you have many files in your project.
I created two python file to play with the install() feature:
temp1.py:
temp2.py:
But run the temp2.py, it throws error : NameError: name 'op' is not defined What is the correct usage of install() ? Thanks !