from threading import Event # Create a shared event that can be imported by multiple modules generation_interrupt = Event()