Cut ground or hot to avoid parasitic power

I have a 1284P that acts as a master that is talking to an ESP8266 and an Arduino Nano over the two hardware serial lines. I’ve noticed that when I disconnect power to the nano it will still run just fine, drawing power through the serial lines I guess.

I want to put both of these devices where I can control power to them from the 1284 with a mosfet. So my question is how can I do that and avoid any parasitic power to those boards? Will it help to hold the Serial pins in a given state? I don’t really understand what the fundamental problem is. Should I put the power control to cut the power or the ground? Do I need to “park” the serial lines somehow?

" Do I need to "park" the serial lines somehow?"
Yes. Any IO line that is high when the VCC pins are low will power the VCC pin thru the 328P output protection diodes.
That is why IO levels are not supposed to go higher than VCC+0.5V and Gnd -0.5V.

So you can cut power to the VCC pins with a P-channel MOSFET, and drive any signal lines low.