I think the easiest way would be to register forward hooks as shown here.
Using some condition on all children, you should be able to just register the submodules you need.
I think the easiest way would be to register forward hooks as shown here.
Using some condition on all children, you should be able to just register the submodules you need.