Your charging system has failed, probably the alternator.
If you have no battery then you have no power.
I had a similar problem in a taurus. I had to replace the alternator.
there would either be a short to power in your switch / a short to power in your wiring somewhere between the battery and the bulb . somewhere in there electricity is constant and completely cuts out the selector switch. the lights turn off when you disconnect the battery because that is the only time that power is not applied to the bulbs.
Defective alternator, dead cell in battery, or something is on pulling power from the battery.
if you leave any lights on in the car you may cause you a flat battery. if you leave any lights on in the car you may cause you a flat battery.
With a battery or solar power!
If there is power lost, lights that dim and a battery light that comes on there is most likely a connection that is loose somewhere. It would be best to check the alternator or battery cables.
The battery ,which gives power to the truck, looses its power because the lights use power from the battery to work. It's just like a batery for a toy.
When your lights are on and your engine is not running you are taking the power for your car lights directly from your battery. If you leave them on long enough, you will run down your battery and your car will not start. Then you will need a jump.
Sounds like you have something that is on all the time and drawing power from the battery. Check, dome, courtesy, trunk, hood, glove box, and brake lights.
In the Power Box next to battery.
check and clean the battery terminals