What I would somewhat like to do is:
model_nodes = list(model.graph.nodes)
block_nodes = list(model.graph.nodes)
block_nodes[0].replace_all_uses_with(model_nodes[insert_idx])
model_nodes[insert_idx].replace_all_uses_with(block_nodes[-2])

However I don’t think this works, the block nodes are referring to modules not present in the model. I can add the block as a module to the model, but I think replace_all_uses_with is only intended to work with nodes already added to the graph if that makes sense.
I would be really thankful to anyone willing to share some help.