Visible-light-driven stacked-layer heterogeneous photocatalyst carbonitride/tungstophosphate (TCN) was constructed via in-situ solid-state thermal transformation using melamine phosphotungstate (MPW). The structural, morphological and optical properties of the samples were investigated. Compared to the MPW hybrids and phosphotungstic acid hydrate, the TCN photocatalysts showed excellent visible light photocatalytic activity. During the thermal transformation, the melamine molecules polymerize to form the defective heptazine structure carbonitride attached to the surface of mixed-valence Keggin units. The interfacial POMs anions-π interactions, ligand-to-metal charge transfer and mix-valence organic-POMs structure makes the electrons fully delocalized over the MPW hybrids, and the TCN photocatalysts obtain the extended light absorption. The Keggin units accept and transfer electrons, so the recombination of photogenerated carriers is suppressed. 13TCN-390 obtains the optimal photocatalytic activity, its photocatalytic degradation efficiency of imidacloprid and rate constant k are 6.38 and 13.50 times than that of CN-390, respectively. The enhanced photocatalytic activity arises from the extended light absorption, suppressed photogenerated carriers' recombination, surface structure defect and suitable band structure. h+ and OH are the main reactive species when the proposed photocatalytic mechanism was done. This study provides a promising construction strategy for polymer/POMs photocatalysts using different organic-POMs hybrids.