class RespawningProtocol: def __init__(self, *args): self.args = args def spawn(self): reactor.spawnProcess(self, self.args...) def processEnded(self, reason): self.spawn() class XYZProcessProtocol(RespawningProtocol): # do whatrever myProcesses = [ XYZProcessProtocol('sleep', '10') ] if __name__ == '__main__': for process in myProcesses: process.spawn() reactor.run()