The g-C
3
N
4
/polymer polyaniline (g-C
3
N
4
/PANI) is synthesized using constructing heterojunction strategy for CH
3
OH production by CO
2
photoreduction. The CO
2
photoreduction performance for CH
3
OH production of g-C
3
N
4
/PANI was investigated by regulating PANI content. The construction of the heterojunction effectively promotes the separation of photogenerated carriers with a high charge transfer rate, contributing to CO
2
photoreduction. Besides, the incorporation of the PANI layer enhances electron transfer efficiency and improves CO
2
adsorption capacity. The g-C
3
N
4
/PANI also exhibits good selectivity for CH
3
OH production, with a selectivity of 95.26%. The g-C
3
N
4
/PANI still maintains excellent CO
2
photoreduction activity after cycles. The mechanism of the CH
3
OH production from CO
2
photoreduction is analyzed through the energy band structure.