I would like to install a shaver socket in my bathroom and the closest power supply is the bathroom light switch. Instead of lifting all of the loft insulation to find the lighting junction box, is it permissible to take a spur from the bathroom light switch to power a shaving socket, which is fitted with a transformer?
The bathroom light switch box might not have a neutral in it, and you need both a hot and a neutral to power anything.
In the US in older construction the light switch may be connected to the controlled light with a "switch loop", meaning a line hot on one connection of the switch and a switched hot on the other. The line hot and the switched hot are in the same cable going to the box with the light fixture. One of these two wires would normally have white insulation, and so is sometimes mistaken for a neutral.
However, sometimes the line hot cable enters in the switch box and in that case there is a neutral in the switch box. In that case one can install a cable leading from the switch box to a receptacle.