Just to clarify what tanvir_ahmed wrote. You legally only need a Class 2 Medical for your entire flight training up to the CPL. As long as your Class 2 does not have an OSL (Operational Safety Pilot Limitation), you can absolutely fly all your PPL and CPL solo hours without a safety pilot. The OML is specific to the Class 1 Medical, which practically only kicks in once you hold your license and start flying commercially. As ShyTorque already pointed out, having an OML on your Class 1 doesn't automatically ban you from flying solo during your training.