Trouble with USB drone connection to Python on boot using DroneKit on RPI

I am trying to activate a solenoid valve when a certain switch is flipped on a transmitter, and I got that working to some degree, but only under certain circumstances. It only works if I boot the RPI, then connect the MicroUSB to the Cube, and THEN launch my program.
When I try to leave the MicroUSB connected when I reboot or unplug and plug in the RPI, I get the message ‘device reports readiness to read but returned no data’ until I unplug and replug it in.
What would cause this error on boot? Is there a way I can force the boot sequence in an order that would work?