The in situ grazing-incidence wide-angle X-ray scattering (GIWAXS) measurements were performed at a specially designed laboratory SAXS/WAXS setup (Nanostar, Bruker AXS, Germany). The metal-jet X-ray source was used to generate Ga Kα radiation (λ=1.34 Å). The X-ray beam with a divergence of 500 μrad (FWHM) was shaped by parallel Montel optics (Incoatec, Germany). The beam divergence was further narrowed by a pinhole collimator composed of two Ge anti-scattering pinholes, each 550 μm in diameter. The total photon flux on the sample was 10 9 photons/s. The sample-detector distance was set to 338 mm. The in situ GIWAXS measurements were carried out at low 0.3° and high 1.5° or 2° angles of incidence. The penetration depth of the X-ray beam into the perovskite layer was several tens of nanometers at an incidence angle of 0.3°, several hundred nanometers at an incidence angle of 1.5°, and 1 μm at an incidence angle of 2°. The calculated dependence of the X-ray penetration depth on the incident angle for all studied systems in this work is plotted in Supplementary Fig. . Therefore, the shallow incident angle probed the top part of the MHP layer, while the larger incident angle probed the entire thickness of the layer or bulk. The GIWAXS patterns were recorded by a single-photon counting 2D X-ray detector (Pilatus 300K, Dectris, Switzerland). The exposure time in the real-time experiment was 1 s. The hot plate for sample annealing was placed into the plastic box with entrance and exit X-ray windows made of polymer foil. The adjustement of the incident angle was done by a hexapod (H-811, PI, Germany), on which the plastic box with a hot plate was mounted. The plastic container with the sample was filled with inert nitrogen gas to lower humidity below 10 %. The hot plate was pre-heated to the temperature of 150 °C.