Headlights and Dashlights cutting off

My daughters 2016 CX5 has started to have an intermittent issue with basically all lights just cutting off for about 35-45 seconds. Sounds like a relay getting hot and kicking out to me? This has happened twice recently. The first time a check engine light came on and autozone checked and gave a P0882 code. The second time no check engine light came on. A search of the code says it's transmission control module code. Though she didn't mention any issues with the transmission, only loss of all lighting. This all started after some front end repair from an accident. One headlight was replaced.

The shop had originally put in a used one that was fogged and since the insurance had payed for a new part she went back and they replaced it with a new one. Now the issue has begun, also one of the daytime driving lights is not working if that could have anything to do with it.

Could the new part be an aftermarket replacement that isn't communicating properly with the computer system? How could I even tell if it's OEM or not? Thanks for any advice.
 
Sounds like an intermittent short or a near broken wire. No fun at all to track down but, check harnesses and connections in the area of the crash damage
 
Since this started right after the front-end repair, I’d strongly suspect a wiring or ground issue rather than a relay or module. All lights cutting out at once usually points to a loose ground, damaged harness, or a connector not fully seated near the headlight/DRL area.

The P0882 code can show up from a momentary voltage drop, not necessarily a bad TCM. One DRL not working also supports a wiring/connector problem. I’d have the body shop recheck all front-end grounds and headlight connectors, and confirm whether the headlight is OEM (Mazda logo/part number on housing).
 
Back