2

My python script calls another python scripts method (which runs an infinite loop and performs some activity) and runs it as thread. I want to kill my calling python script as soon as the thread dies

2
  • Make the other python script add '1' to a txt when it's done, and then put a while loop in the original, and once it detects the '1', then end the program Commented Jun 29, 2018 at 6:09
  • my called python script runs an infinite loop. It cannot end. if it gets killed somehow then I want to terminate parent Commented Jun 29, 2018 at 7:00

1 Answer 1

1

Are you using the module threading? If so, you could periodically check the status of your thread via the method threading.is_alive().

If your infinite thread is killed somehow, your permanently checking main thread (possibly notified by another thread initialized like this) can also terminate.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.