The magnetism of carbon nanomaterials is dominated by the structure of its carbon skeleton. However, the magnetism engineering is hindered due to finite precursors. Here, we develop a new strategy to engineer the magnetism of nanographene through hetero-coupling two different precursors on Au(111) surface by using low-temperature bond-resolved scanning tunneling microscopy and scanning tunneling spectroscopy, combined with spin-polarized density functional theory calculations. Our results demonstrate that two homo-coupled products host close shell structure along with defects inducing magnetic one with the total spin number S = 1/2. Upon simultaneous depositing with another precursor, two hetero-coupled products switch to magnetic structure with the S = 1/2 and S = 1 resulting from carbon skeleton transformation. Our results provide a valid way via inducing different molecular precursors to engineer the magnetism of carbon nanomaterials, which could be extended in other magnetic materials instruction.