-4

I've been looking around the web and I found no articles saying how to close a terminal using Python code.

This is my code:

if optionInput == "6":
exit()

I want it to close the terminal instead of just ending its process. I've seen other projects have that and I want to do the same. Is there any way to do that? Thanks

xKwm1
  • 1

1 Answers1

1

try this

import os, signal
os.kill(os.getppid(), signal.SIGHUP)
senpai
  • 76
  • 1
  • 5