Just went through this, unfortunately I think I fixed it by b.s. luck.
Headlight switch? There is a circuit breaker internally. If overloaded it'll trip, after a little bit it'll "reset", giving you a flashing.
Verify all wiring is good and clean. I had 1 ground broken in a factory splice. Didn't see it until about 3rd trip in. Also check dimmer switch. Verify its working properly.
I did a "relay mod" to take some of the electrical strain off the factory switch. Factory pulls all juice through the headlight switch, now it's just enough to trip the relays and fire off the lights. Lights are a little brighter now also.
BTW, welcome.