def spawn_after(cls, seconds, func, *args, **kwargs): instance = cls() # wrap func to be scheduled immediately def _func(): func(*args, **kwargs) sleep(0.0) def _deferred_spawn(): instance.bind(_func) instance.setup() after_func(seconds, _deferred_spawn) return instance.ref
def send_after(self, seconds): after_func(seconds, self.send)