Seeeduino powering by 3.7v 500Mamp/h Li-po Battery and USB for programming it at the same time

Hi, I have a circuit in mind, but first I want to known, if I can connect a 3.7v Li-po Battery to power the seeeduino and, if i want to program the micro, i can do it without disconnect the battery.
I see in other webs, they put a switch between battery and seeeduino, to turn off manually while programming.

I want an explanation or the schematic to do it without the switch

thanks

I think this question is too much for all the people in this forum, I think, in this forum, is more easy to know if the cat of Schrödinger is live or dead without open the box

I am using XIAO with an external power supply connected to the 5V pin of XIAO via a Schottky barrier diode.

External power supply + pin --> Anode(Diode)Cathode --> XIAO 5V pin
External power supply - pin --------------------------------------> XIAO GND pin

I had thought about that solution, but that diode has a high voltage drop and the battery will not last long.
I think about using a P Chanel MOSFET, theoretically it has no voltage drop.
Bat 3.7V neg to GND
Bat 3.7v pos to MOSFET DRAIN
Pin 5v to MOSFET SOURCE
MOSFET SOURCE TO GATE

The MOSFET detects where voltage is bigger

I think it’s a good way to reduce the voltage drop if you use a PMOS with a sufficiently small on-resistance.