[Solved] Python calling function in an function from another function


Define your function example as this:-

def exemple(func_name):    
    def dostuff1():  
        print('Stuff 1')  
    def dostuff2():  
        print('Stuff 2')  
    def dostuff3():  
        print('Stuff 3')
    func_dic = {
        "dostuff1" : dostuff1,
        "dostuff2" : dostuff2,
        "dostuff3" : dostuff3
    }
    return func_dic[func_name]

Then call your function in the other function like this:

def training():
    exemple("dostuff2")()

I hope it helps!

3

solved Python calling function in an function from another function