Just in case, someone helped me with the solution:
from torch.nn import Module

class Module1(Module):
    def __init__(self, dim1):
        Module.__init__(self)
        self.dim1 = dim1


class Module2(Module):
    def __init__(self, dim2):
        Module.__init__(self)
        self.dim2=dim2


class Module12(Module1, Module2):
    def __init__(self, dim1, dim2):
        Module1.__init__(self, dim1)
        Module2.__init__(self, dim2)