1

Hi I see many different solutions to this such as .terminate(), sys.exit(), os.kill however I can not find one for what I am trying to do.

I run my file using the following:

import publisher

publisher.myfunc(mess[0],mess[1])

How can I terminate this process in another script when I am not using subprocess or os to start the scirpt?

Sarada
  • 11
  • 2
  • I don't think that is possible without calling it through sys or OS. Importing is like running the code inside the imported file in the importing file. I can think of a way to do it with threads, but even then os or sys is a better choice than threads. – Mohamed Yasser May 21 '22 at 11:41
  • I agree with @MohamedYasser. You can check out the `subprocess` module. https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command – Vae Jiang May 21 '22 at 11:56

0 Answers0