This won’t work, as your A module won’t be registered in a plain Python list, so you would have to use a nn.ModuleList instead.
This will make sure to register the passed module as well as all parameters in the parent module.
Calling B.parameters() will thus yield all parameters.
You could double check it via print(dict(modelB.named_parameters())).