Dave,
There are several ways to install Railpro in a ScaleTrains SD40-2. One way as shown by another member here was to purchase a 21-pin adapter (linked above) and plug in the module. Another way, which is more complicated, is what I did.
I completely removed all factory electronics, keeping only the rear headlight LED. The reason I removed all the other LEDs is because the prototype I am building has no class lights, but does have ditchlights. The stock front headlight was too dim for my taste so I replaced it with my own LED. I'm not interested in lighted number boards either so I removed those. Removing the factory board frees up a ton of space above the weight. Plenty of room for a module. I also installed a keep-alive (located in the factory speaker box) and two sugar cube speakers. It was all a tight fit, but definitely doable.
Here you can see where I put the keep alive and associated bridge rectifier. This is the only place the KA would fit due to its awkward shape.
Everything in place. Note that there is just enough room for the module and two speakers up top. Not much to spare.
From the side, nice and clean. Note the wires going to the ditch lights and front trucks are tucked under where the cab would be.
And with the shell on you can see that everything fits with no interference. The nose was removed in order to replace with an 81" nose per my prototype.
-Kevin