Would my suggestion not work on your model?
How did you define new_modules? Standard nn.Modules wouldn’t have the name attribute, so you should stick to named_modules() at one point (but I’m unsure how your classes are defined).