I have two python scripts (main.py, sub.py) in different locations. I want to run sub.py from main.py.
sub.py
print("I am for test")
x = 100
I have found multiple options to do that from multiple source which works partially.
main.py
exec(open("c:\\SomePath\\sub.py").read())
# or
%run "c:\\SomePath\\sub.py"
Both the commands execute the sub.py and create 'x' in globals() but don't print anything.Is there a way (simple, a single line code preferable) to do that?