main_folder/
__init__.py
sub_folder1/
__init__.py
run_all_functions.py
sub_folder2/
__init__.py
script1.py
script2.py
script3.py
script1.py
def something():
....
def something2():
....
script2.py
def example():
....
def example2():
....
script3.py
def example3():
....
Would like to check if there are ways that i can run all the functions in different scripts in folder2 and consolidate them in run_all_functions.py in folder1 dynamically. I might add more scripts with functions in folder 2 in the near future.
inspectto load all the methods declared for each module. Then you only have to repeat the process through all the files. This might be useful: stackoverflow.com/questions/139180/…with open(filename, 'r') as file: exec(file.read())