This is related to a SO question, the solution to which gives me the error noted.
How can I get a list of all classes within current module in Python?
Using the green-checked code from that SO answer, I want to get a list of all class names in my own module, locations.py:
import locations
def print_classes():
for name, obj in inspect.getmembers(locations.modules[__name__]):
if inspect.isclass(obj):
print obj
print_classes()
When I run this, I get AttributeError: 'module' object has no attribute 'modules'
I have tested locations.py -- it contains 31 skeleton classes; it throws no errors.