-1

How do I get all the classes in a module? For example if a module has classes A, B and C, how do I get the names of all these classes through code?

1 Answers1

0

Try this:

import importlib, inspect

inspect.getmembers(
    importlib.import_module("your_module"),
    inspect.isclass
)

this will give you what you are looking for.

Mehrdad Pedramfar
  • 10,941
  • 4
  • 38
  • 59