Chosen Solution
Can you use an iPhone 8 Plus camera to replace the camera on the iPhone 7 Plus?
Full disclosure, I haven’t tried this myself so perhaps someone who has can confirm or deny. Looking at the cameras (assuming you meant the rear camera) online (iPhone 7Plus / iPhone 8Plus), they don’t appear to have the same flex cables. The 8Plus cables are longer. Also, Apple has a tendency to make parts slightly different, either with the pinouts of the connectors or the actual connectors themselves even if the internal guts are the same.
I looked on iFixit, unfortunately the cable connecting to the motherboard on the iPhone 8 Plus is shorter than the iPhone 7 Plus one, so not easily, unless you somehow lengthened the iPhone 8 Plus camera length iPhone 7 Plus Dual Rear Camera iPhone 8 Plus Dual Rear Camera