Without doing a "hands on troubleshooting" of the electrical system, NO ONE can tell you specifically what defect is causing this.
It could be no more than a "fluke" with the security system [if so equipped] tripping and flashing the lights. However, this usually results in the horn blowing also, and since you don't mention this, that tends to rule out the security system. This therefore suggests some other defect as the cause.
Therefore, it sounds like you may have a vehicle equipped with an automatically self-resetting Circuit Breaker to protect the headlight circuit from what is called a "short circuit" condition.
If that is the case, then I suspect that one of the "hot" wires delivering power to the headlights from the switch and/or the headlight relay (if so equipped) has had the insulation on the wire to become damaged, allowing it to touch a grounded portion of the vehicle's body sheet metal.
T
he grounded condition causes immense current [measured in Amperes (Amps)] to flow through the circuit, thus causing the Circuit Breaker to "trip" to prevent overheating of the wire, thus damaging the wire(s), or worse, causing a fire which could destroy the vehicle.
For safety while driving at night, self-resetting Circuit Breakers are installed to allow the current to momentarily to be cut off to reduce overheating of the wires, but to also momentarily turn the lights back on to allow the driver to see to safely slow down, get off the road, and stop.
IF a short circuit in the headlight circuit is the culprit, check the entire wiring circuit for the following:
because you turn them on and off, on and off...
If the headlights flash on and off, there may be a problem with the bulbs or fuses. There may also be a problem with the battery connections or wiring.
you've got a short or a bad fuse
You could be hitting the flash feature on the turn signal arm when you use it.
The headlight switch is faulty.
i have only seen that happen when you use the keyless entry system.
There are a couple of different times when you'd turn off your headlights. You'd turn off your headlights when the car is off for example.
you probly have loose light bulbs
No this is a myth and what dumb question
do the headlights come on automatically or manually, if manually turn off
Short circuit in your vehicle alarm system. In most alarms, some lights will flash on and off as an indicator of an attempted break in.
how do i turn off the headlights of my toyota 4 runner 2000 while the car is off?