I would like to know how to convert a string input into a variable name to use into Python code. A concrete example:
def insrospect(foo, bar):
requested_module = makestringvariable(foo)
requested_object = makestringvariable(bar)
import requested_module
for item in inspect.getmemebers(requested_module.requested_object):
member = makestringvariable(item[0])
if callable(requested_object.member):
print item
if __name__ == '__main__':
introspect(somemodule, someobject)
So here above, because i do not know which module to introspect before launching, i need to convert the string to a usable module name and because getmembers() returns the members as strings, i also need them to be converted into usable variable names to check if they are callable.
Is there such a makestringvariable() function?