self.foo.start()

def stop(self):
    if self.foo:
        self.foo.kill()
self.foo.wait()
self.foo = None
foo = foo_class()
foo.start()
time.sleep(5)
foo.stop()
How to kill a subprocess initiated by a different function in the same class