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 the 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?