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

LazyCoder
  • 287
  • 1
  • 3
  • 10
  • 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 – whackamadoodle3000 Jun 29 '18 at 06:09
  • my called python script runs an infinite loop. It cannot end. if it gets killed somehow then I want to terminate parent – LazyCoder Jun 29 '18 at 07:00

1 Answers1

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.

I. Amon
  • 174
  • 11