Photoinduced polarization inversion in a polymeric molecule