+ 1
How to run a python program from the same directory as the source Python code?
I have a folder in my drive called "Scripts". In it are "a.py" and "b.py". I want to run "a.py" in "b.py". Not a function, which I know I can use "import". The whole file, almost like "b.py" is a function. So, while "a.py" is running, it would pause for a little bit, where "b.py" would run. How would I do this? If not, is there any external module I can install which does this for me? Thanks very much, VortexYT.
3 ответов
+ 7
What you're looking for is the exec() method. Check it out:
https://code.sololearn.com/c5f76DBYhYSO/?ref=app
+ 2
Hey! I had a match against you!! GG btw!
+ 2
And thanks!