We developed a new anion-imprinted electropolymerization method to form com
plementary cavity to the size of the used electrolyte anion as template in
the cross-linked polyviologen film prepared by reductive coupling reaction
of trifunctional monomer. The film has both size-dependent anion exchange p
roperty due to the anion-imprinted cavity and photoreduction property of th
e viologen moieties strongly dependent on the electron donability of the ex
changed anion in the film. The anion-imprinted polyviologen film plays a ro
le in a new type of optical sensing to recognize various anions.