Apr-25-2022, 01:06 PM
Hey everyone !
Here is my problem : I have defined a class, where I have defined some functions. In the __init__ of my class I can call some of the defined functions . The problem is that some of these functions can sometimes take a long time to execute. How can I set a timeout in these functions, so that they stop if they take too long?
For example :
class test:
def __init__(self):
self.do_actions_1()
self.do_actions_2()
def do_actions_1(self):
"bla bla bla bla bla"
def do_actions_2(self):
"bla bla bla bla bla"
If one of these actions takes too long, how can I stop it?
Thank you for your answer! :)
Here is my problem : I have defined a class, where I have defined some functions. In the __init__ of my class I can call some of the defined functions . The problem is that some of these functions can sometimes take a long time to execute. How can I set a timeout in these functions, so that they stop if they take too long?
For example :
class test:
def __init__(self):
self.do_actions_1()
self.do_actions_2()
def do_actions_1(self):
"bla bla bla bla bla"
def do_actions_2(self):
"bla bla bla bla bla"
If one of these actions takes too long, how can I stop it?
Thank you for your answer! :)