How to call a function from a string in Python

1 Answer

0 votes
def Func1():
    print('Func1')

def Func2():
    print('Func2')

locals()['Func1']()
globals()['Func2']()



'''
run:

Func1
Func2

'''

 



answered Apr 15, 2021 by avibootz
...