I'm currently searching for a possibility to get to know if there is power in a circuit with a Pin of the J8 Header (Pin 26). I bought a tutorial Book to a starter Kit and a huge Book about the raspberry Pi itself, but now I'm stuck. In both books they said it would be possible to detect by programming if there is a circuit running between a Pin and GND. How to do that, I've got no idea.
You read the GPIO. If there is a high voltage (3V3) it will read 1, if there is a low voltage (ground, 0V) it will read 0.
Pin 26 is (Broadcom) GPIO 7.
Ensure that you do not feed a voltage greater then 3V3 into a Pi GPIO. You will likely damage the GPIO and/or the Pi itself.
There are several Python GPIO libraries.