Quick answer: Run Twisted in a thread, or use asyncpygame for asyncio-style cooperation. Don’t block main with reactor.run().

Game freezes because Twisted's reactor.run() blocks main. Pygame events stop pumping.

The Fix

import threading
from twisted.internet import reactor

# Twisted in worker thread
threading.Thread(
    target=reactor.run,
    kwargs={"installSignalHandlers": 0},
    daemon=True
).start()

# Main thread: Pygame loop
while running:
    for event in pygame.event.get():
        ...
    pygame.display.flip()
    clock.tick(60)

# Cross-thread comms via Queue

Threaded Twisted keeps the network responsive. Main thread runs Pygame uninterrupted. Use a Queue for cross-thread message passing.

Verifying

Game responsive while network active. Without thread: freezes after reactor.run.

“Network in thread. Pygame on main.”

Related Issues

For multiprocessing pickle, see multiprocessing. For Clock busy, see Clock busy.

Network thread. Main pumps.