I have an API that has functions (e.g. function1, function2, etc) where each function is placed in a file (file1, file2, etc) and all files are in a directory, dir. The structure is as so:
dir
-> file1.py (contains function1)
-> file2.py (contains function2)
...
I want to create a new function that returns all functions in every file in dir (ie. I want to create a list [function1, function2, ...]) so that the user can view all functions available. Since more functions/files will be create in dir, I want my new function to automatically walk through each file and create the list, rather than hardcoding a list somewhere.
I've been able to use os.listdir to get the filenames, but how can I get functions inside each of the files from the filenames?