I am trying to use inspect.getmembers to test classes and functions inside a file. The problem is that I do not know how to pass the file name to inspect.getmembers without using import . This is because I need to specify a different file name each time
The code looks something like this:
def extractName(self,fileName): for name, obj in inspect.getmembers(FileName): if inspect.isclass(obj): print "this is class",name if inspect.isfunction(obj): print "this is method",name
source share