* Vehicle make and model: Some vehicles are designed to allow flywheel replacement with the engine in place. Others make it significantly easier or even necessary to remove the engine. Access to the flywheel is the key factor.
* Transmission type: Manual transmissions generally require more disassembly to access the flywheel than automatic transmissions.
* Mechanic's skill and tools: A skilled mechanic with the right tools might be able to do it with the engine in, even in a vehicle that's typically considered to require removal.
In short, while it's *sometimes* necessary to pull the engine, it's not *always* required. Consult a repair manual specific to your vehicle to determine the best approach.