I have a code that I wish to split apart into multiple files. In matlab one can simply call a .m
file, and as long as it is not defined as anything in particular it will just run as if it were part of the called code. Example (edited):
test.m (matlab)
function [] = test()
... some code using variables ...
test2
test2.m (matlab)
... some more code using same variables ...
Calling test
runs the code in test as well as the code in test2.
Is there a similar way for python, to put ... some more code ...
, into an external file, that will simply be read as if it is in the file that it is called from?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…