When the ignition is on (engine is not running) the lights work fine.
Once the engine starts, the headlights begin to flicker and / or also turn off.
The reason behind this is because the kit you have installed may not be a canbus kit or be the latest variant of a canbus equipped kit.
Solution: Install a canbus kit.
Temporary solution - Install a decoder (this may not work depending on how basic your xenon / hid kit).