Metal poly(heptazine imide) (MPHI) exhibits various optoelectronic functions by accommodating various metal ions in its heptazine-based graphite-like two-dimensional layer. Although potassium PHI (KPHI) is the most well-studied in MPHI series, there are unresolved issues regarding the mechanism responsible for its unique properties, particularly its high photocatalytic activity. The mechanisms underlying other diverse properties, such as photochromism and photoconduction, also remain unknown. Herein, we focused on elucidating the mechanisms of photochromism and photoconduction in KPHI. We developed a method to gradually replace K + in KPHI with H + and successfully prepare samples with tunable K + concentrations. The structural, chemical, optical, electronic, and electrical properties of samples with continuously varying K + concentrations were thoroughly investigated through various experiments and theoretical calculations. First, the gradual substitution of K + for H + in KPHI was investigated using X-ray photoelectron spectroscopy, X-ray diffraction (XRD), and Fourier-transform infrared spectroscopy. XRD analysis revealed that K + in KPHI was not randomly substituted with H + , but even small amounts of K + substitution led to the formation of the long-range ordered region of HPHI. Absorbance measurements revealed a continuous blue shift of the absorption edge as the ratio of K + decreased from that of KPHI. Energy band calculations revealed that the energy gap of HPHI was more than 14% larger than that of KPHI. The dependence of the K + concentration measurements on the photochromism and photoconductive properties showed that in the K +rich samples, the K + released from the PHI layer upon white light irradiation had a significant effect on the electrical conduction properties. K + conduction was dominant in the electrical conduction of KPHI, including photoconduction, under ambient conditions. However, the mobility of H + in HPHI was very low, which was responsible for the lethargic return to the ground state after photoexcitation and minimal electrical conductivity.