Chosen Solution

Both are model A1466. I just tried the swap now and when I put the SSD from the dead 2017 into the 2015 in comes up with a flashing folder with a question mark. If I hold down the option button when powering on the only choice is network. Does this mean the SSD is dead or corrupted?

Yes they are compatible. To confirm either of those you’ll need to boot a MacOS installation media (via USB or internet recovery) and check if it is detected under disk utility.