xenon head lights on the right side when out on 1999 BMW 328i

it stared going off an on just about two hours ago and then when out but if. I turn then off and give it a few mins they come back on I had some work done to that side the same problem happened about two years ago

2 answers
It could be a failing bulb, loose wiring or poor electrical connection or a failing transformer. The system works on very high voltage and you can easily be shocked so be very careful.
ballast or transformer wire or the ballast (transformer) itself is on it's way out.