When electricity is available transformer will provide 6v output. This passes through diode and charges battery. But the (+)ve charge from transformer turn off PNP transistor and light don’t glow.
When electricity is not available PNP transistor switches and LED glows from the battery power.
This circuit acts as an emergency light. Here the switching capability of transistor is used.