Using same pins number in different arduino?
The notion that “both Arduinos are in the same sketch” is slightly off.  Each of the Arduinos will contain a program; their programs might be identical if you do some fancy programming, but it is simpler to write one sketch per Arduino.

Thus, your first Arduino will run a sketch designed to control the devices it is connected to, and your second Arduino will run a sketch designed to control the devices that it's connected to.  Conceivably, you might have some devices that both Arduinos connect to.

Calling the two sketches S1 and S2, the device on pin number n as referred to in S1 will typically be a different device than the one on pin number n as referred to in S2.  Most but not all of the pin usage assignments for each pin number will be different in one sketch versus the other. 

It's likely the two Arduinos will need to communicate with each other.  For a range of methods, see for example  How to have an Arduino communicate with 3 other Arduinos.  For additional detail see Arduino-to-Arduino serial communication and How to network many Arduinos with sensors using I2C.

If you decide to use I2C, then also see MasterWriter Tutorial and Wire Library webpages at arduino.cc.