In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?
Although Quamrana's suggestion works fine, there are a couple of possible improvements I'd like to suggest to make it more pythonic. They rely on using the inspect module from the standard library.
inspect.getmembers()inspect.isclass()With those, you can reduce the whole thing to a single list comprehension if you like:
def find_subclasses(module, clazz):
    return [
        cls
            for name, cls in inspect.getmembers(module)
                if inspect.isclass(cls) and issubclass(cls, clazz)
    ]