0

I am new to python and i have some trouble with my passing from one running script to another one WITH terminating the first one. It is probably super basic, i just could not find anything on that.

With a button beeing pushed i am passing over to another python script using execfile(). The problem is that those two scripts are obviously running parallel now. I would like the first one to stop with the start of the second one. Any recommendations?

  • Are you running the scripts in a shell or terminal? If you're running a script in the shell, you'll press control C to cancel the script, and then run the other script. – Simeon Ikudabo Mar 10 '18 at 22:59
  • you should share some information about why you are approaching it this way. if script `a.py` is sitting next to `b.py` then `a` can just `import b` and use it's functionality directly. It is a more direct and scalable way of programming than chaining script execution like a batch file. You should try to avoid using functions like `exec` and `execfile`, especially if you are new to python. – Preet Kukreti Mar 10 '18 at 23:00
  • Welcome to SO. If there is a way to do it, it is probably not unique, and depends on a lot of factors. So make sure you include as much information as possible. Please see https://stackoverflow.com/help/how-to-ask – Ash Mar 10 '18 at 23:00

0 Answers0