MCP23017s on Arduinos able to detect source pin address between each other

The problem is in your code. Until you post it we can't tell exactly what it is you have done wrong or misunderstood.

You may want to read this before you proceed to see how to post code correctly here:-
how to get the best out of this forum