Two heterocycle-based derivatives that can be used as two-photon absorption chromophore, 9-butyl-3-(2, 6-diphenylpyridin-4-yl)-9H-carbazole ( BDPYC) and 9-butyl-3-(4-(2, 6-diphenylpyridin-4-yl)styryl)-9H-carbazole ( BDPSC) have been successfully synthesized and fully characterized by elemental analysis, IR, 1H NMR, 13C NMR and MS. The molecules possess D-π-A structures, but have different π bridge. The 9-butylcarbazole is used as a donor (D), and the pyridine ring is used as an acceptor (A). One- and two-photon absorption and excited fluorescence properties in various solvents were experimentally investigated. Two-photon initiated optical data recording experiments have been carried out under 740 nm laser radiation, and the possible mechanism of optical data storage is discussed based on theoretical calculations.