In this work, an intramolecular carbon nitride (CN)-based quaternary homojunction functionalized with pyridine rings is prepared via an in situ alkali-assisted copolymerization strategy of bulk CN and 2-aminopyridine for efficient visible light hydrogen generation. In the obtained structure, triazine-based CN (TCN), heptazine-based CN (HCN), pyridine unit incorporated TCN, and pyridine ring inserted HCN constitute a special multicomponent system and form a built-in electric field between the crystalline semiconductors by the arrangement of energy band levels. The electron-withdrawing function of the conjugated heterocycle can trigger the skeleton delocalization and edge induction effect. Highly accelerated photoelectron-hole transfer rates via multi-stepwise charge migration pathways are achieved by the synergistic effect of the functional group modification and molecular quaternary homojunction. Under the addition of 5mg 2-aminopyridine, the resulting homojunction framework exhibits a significantly improved hydrogen evolution rate of 6.64mmol g-1 h-1 with an apparent quantum efficiency of 12.27% at 420nm. Further, the catalyst verifies its potential commercial value since it can produce hydrogen from various real water environments. This study provides a reliable way for the rational design and fabrication of intramolecular multi-homojunction to obtain high-efficient photocatalytic reactions.