The invention relates to application of pyrilamine compounds to the preparation of an acetylcholinesterase inhibitor. The pyrilamine compounds have a structure of a general formula I, wherein in the general formula I, S1 is selected from O, S, -CH2- and -NH-; S2 is selected from O, S, -N(CH3)-, -NH- and -(CH2)n-, and n is an integral number of 1 to 6; Q1 is selected from hydrogen, halogens, straight chain or branched chain alkyl, cycloalkyl, trihaloalkyl and alkoxy; Q2 and Q3 are selected from the hydrogen, the halogens, the straight chain or branched chain alkyl, the cycloalkyl, the trihaloalkyl, the alkoxy, aryl, heteroaryl, -(CO)R1 and -S(O2)R2 independently and respectively; R1 and R2 are selected from straight chain or branched chain alkyl having 1 to 4 carbon atoms and amino independently and respectively; and X1 and X2 are respectively selected from H, the straight chain or branched chain alkyl having 1 to 4 carbon atoms and haloalkyl having 1 to 4 carbon atoms independently.