Could also be a flaky dimmer switch varying the current to the headlights and in turn making the alternator and other items wig out.
unfortunately I knew a guy many years ago that ignored his flickering h/lights until they went out one cloudy night at a high rate of speed an dhe lost his life when the car slammed into a creek embankment frown pity