The persistent use of pesticides in the agriculture field remains a serious issue related to public health. In the present work, molecularly imprinted polymer thin films were developed using electropolymerization of pyrrole (py) onto gold microelectrodes followed by electrodeposition for the selective detection of chlorpyrifos (CPF). The molecularly imprinted polymer (MIP) was synthesized by the electrochemical deposition method, which allowed in-line transfer of MIP on gold microelectrodes without using any additional adhering agents. Various parameters such as pH, monomer ratio, scan rate, and deposition cycle were optimized for sensor fabrication. The sensor was characterized at every stage of fabrication using various spectroscopic, microscopic, and electrochemical techniques. The sensor requires only 2 μL of the analyte and its linear detection range was found to be 1 μM to 1 fM. The developed sensor's limit of detection (LOD) and limit of quantification (LOQ) were found to be 0.93 and 2.82 fM, respectively, with a sensitivity of 3.98 (μA/(μM)/mm2. The sensor's shelf life was tested for 70 days. The applicability of the sensor in detecting CPF in fruit and vegetable samples was also assessed out with recovery \% between 91 and 97\% (RSD < 5\%). The developed sensor possesses a huge commercial potential for on-field monitoring of pesticides. © 2020 The Authors. Published by American Chemical Society.