Runtime and Context Modules

signal

Interfaces for OS signal handling. Python handlers run in the main thread of the main interpreter and may be delayed until Python executes again. Available signals depend on the platform. This example inspects a signal number without sending signals or changing handlers.

Formal Syntax & Structure

python syntaxpython
import signal

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import signalprint(signal.Signals(signal.SIGINT).name)
Python Reference