Will a check engine light on a car stay on for awhile after a new engine is put in a car to replace an old one?

In most cases the check engine light will come on after you put a new engine in it, it can come on for various reasons, In my case my check engine light came on because my oxygen sensor was reading the fumes from my exhaust in which came from my last engine. eventually iit will turn off but its good to get a diagnostic to be sure that they wouldn't have to replace your sensor