Dont drive, as it might short circuit. You surely have loose connection in head lam. Open the head lamps by yourself if you confident and see if some wire or lamp is loose.
If both headlight flickering, check the head light fuse not the headlight and better change the fuse even if still looks good, it may be on dying stage.