I agree with goldilock that you should not connect two separate power sources. If losing power when connecting to the laptop is a big enough concern to warrant some risk I do have a suggestion.
NOTE: This is a possible solution to the problem based on past experience, but it is not without some risk as you will be modifying a cable connected to the laptop. Consider this a warning!
You could modify a USB cable to carry data, but not power. This can be done by stripping the insulation on a USB cable and cutting the 5v wire (usually red). Confirm using a volt meter. If any of the other wires are damaged in the process, cut all off them and re-attach with solder / heat-shrink (all but the 5v line). DO NOT DISCONNECT THE GROUND. If this has any chance of working, you will need a shared ground.
I've done something similar when working with older models of the Pi; there was concern of back-feeding power coming from the USB ports when using cheap powered hubs. By disconnecting the 5v line from the hub to the Pi's USB port it allowed devices connected to the hub to be powered from the hub's supply, but not bypass the internal protection on the Pi. (see: What's the problem with backfeeding?)
Use the modified cable to connect the pi to your laptop: this will prevent your laptop from powering the pi so you will need keep the power cable connected for the Pi to stay on. You will, however be able to disconnect the laptop without the Pi losing power. Make sure to only use the modified cable when connecting to another source of power. Mark it or even glue it into the Pi (after testing it) to make sure you don't forget.
It's a trade-off, but it should work if the sensor is stationary, has it's own battery or otherwise has a more consistent power supply.
If a battery backup is a better option, make sure to handle charging correctly. I don't have as much experience on that side of things, so check out https://hackaday.io/project/9461-lifepo4weredpi and other battery charging projects first.