# -*- coding:utf-8 -*- class A: pass class B: pass if __name__ == '__main__': import inspect import sys for name, class_ in inspect.getmembers(sys.modules[__name__], inspect.isclass): print(name, class_) """ A <class '__main__.A'> B <class '__main__.B'> """