You could call my_func in __init__ to create your layers:
class Generator(nn.Module):
    def __init__(self):
        super(Generator, self).__init__()

        self.l1 = self.my_func(100)

    def my_func(self, n_out):
        return nn.Sequential(
            nn.Linear(1200, n_out)
        )

    def forward(self, z):
        z = self.l1(z)
        return z

Inside my_func you are creating the nn.Sequential with the layer inside, i.e. the layer will be created with randomly initialized parameters.
If you call this function in your forward, you will re-create your model in every forward pass.