Proxy and module calls

Thank you for the answer.
Let me add a bit more context to my problem.

I would like to replace a block by another block (e.g. a backbone), this block eventually have leaking connections (skip connections from inside the block to outside the block).

Previously I was doing it by adding the new block using add_module as a single Module and then adding a node to the graph (using graph.inserting_before(node)), and erasing every nodes from the replaced block.

The problem with this approach is that it didn’t allow me to remap leaking connections because I was inserting the new block as a single module (as if it was a single layer).
So I would like to insert the new block “layer by layer”/node by node, and I am looking for a solution to do it.

The solution proposed in this discussion is to use Proxy to recreate the graph, but I am struggling to use proxy with modules, hence this post.
While the proposed solution solve the small example I gave, I am not sure how to use it in my context, that is merging two Module together/replacing a block by another block.