How to get the class name as a string?

func1 = [class_A(dim=2, parity=i%2) for i in range(2)]

func2 = [class_B( 2, 2, 1, 1)]

funcs = list(itertools.chain(*zip(func1, func2)))

class Main_model(nn.Module):
    def __init__(self, funcs):   # funcs is a list of all the classes with the init parameters passed 
        super().__init__()
        self.funcs = nn.ModuleList(funcs)
      

    def forward(self, x):
        .......
        for func in self.funcs:
             ....  #print the name of the func alone as a string

        return

How to get the names of the classes as a string ?
Please help

The .__class__.__name__ attributes should work:

class ClassA(nn.Module):
    def __init__(self):
        super().__init__()


class ClassB(nn.Module):
    def __init__(self):
        super().__init__()
        

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.a = ClassA()
        self.b = ClassB()
        
model = MyModel()
print(model.__class__.__name__)
# MyModel
print(model.a.__class__.__name__)
# ClassA
print(model.b.__class__.__name__)
# ClassB