Iam creating a code in Python in which I have defined in total of 8 functions. These functions are called and should be executed one after another in series. If one fails, other function will not work. My question is how to call the functions only if the previous function is executed correctly. I can do it using if loop while calling. But is there any other effective way which I can use?
def func():
do something
return
def func2()
do something
return
def func3()
do something
return
def main():
func()
if func():
func2()
if __name__ == '__main__':
main()
Is there any efficient way other than this?