It is unlikely that a headlight would cause that.
Most vehicles have a procedure for reading a code put out by the check engine light. Something like turn the ignition on for a second then back off, then on. When the onboard computer gets the signal it will flash a sequence of long and short blinks that can be converted to a number that tells you what the problem is.
The procedure for doing that will be in the vehicle service manual or a Haynes manual for that make and model vehicle.
yea but what would cause that to come on because the check engine light never came on untill I hit the racoon on accident then after that it came on and I looked at the engine and it seemed like nothing was wrong the car still started up fine
The check engine light indicates problems with a lot of things other than the car just starting. If your theory is correct, when you replace the headlight, the check engine should go off. If it was my car, I would want to know what the problem was before I drove it. A car with no oil will start but you don't get far with it.