How to get the next element in a nn.ModuleList?

how to get the next element in nn.ModuleList in an iteration? Please help

class A(nn.Module):
    def __init__(self,func):
        super().__init__()
        self.func = nn.ModuleList(func)
      

    def forward(self, x):
        for fun in self.func:
            # get the current and next func 
     return

You can use zip:

class A(nn.Module):
    def __init__(self):
        super().__init__()
        self.func = nn.ModuleList([
            nn.Linear(1, 1),
            nn.ReLU()
        ])
      

    def forward(self, x):
        for a, b in zip(self.func[:-1], self.func[1:]):
            print(a, b)
    
        return x

model = A()
model(torch.randn(1, 1))
# Linear(in_features=1, out_features=1, bias=True) ReLU()