Solved by albanD in post #9 
              
              
                If you have the same tree structure, you should encounter the same modules at the same time during the forward no? So you can simply .append() and .pop() your list.