1

i call a python script from a C script using a system call (i know this isn't best practice, but for now it does the intended job).

while the C is running at the command line, i can cancel it using Ctrl-C.

when i am running the python script, when the code follows into particular if clauses, i would like to cancel the C script using a Ctr-C call to the command line, the same as if i could do it manually.

is this possible please?

user1479836
  • 93
  • 1
  • 2
  • 5

1 Answers1

1
import signal
import os

os.kill(0, signal.CTRL_C_EVENT)
nehz
  • 2,172
  • 2
  • 23
  • 36