Imports a module and then goes through the module's namespace to find any functions (you may assume any object with a call() method is a function) and print the names of the functions and their arguments, in the same way as it might appear in a def statement.
My problem is after I have loop through the module and gotten all the function I can not pass the function name to inspect.getfullargspec() because it is a string.How do i make the string callable?
import inspect
from smtplib import SMTP
from pprint import pprint
def func(x):
for item in inspect.getmembers(x):
lst = inspect.getmembers(x, inspect.isfunction)
for items in lst:
func_names = items[0] #names of functions
f = r"%s.%s" % (x.__name__, func_names)
arg = inspect.getargspec(f)
print(f)
if __name__ == '__main__':
func(SMTP)