The switch has a roller contact, when the pin wears the slot in which it sits on the plunger, the lights go on and off while running, sometimes it can be the spring behind the switch contact plunger, buy a cheap lighter pull the roller off and the spring is about right for a replacement, if roller, then it needs either replacing with a new one, or one turned up with wider pin to fit the hole,
Thank you for your replies.
I shall take a look at what you both suggest when I can.
I have a shoulder problem and getting the bike out it a bit of a 'ouch!' at the moment.