We demonstrate the preparation of flexible polyaniline–silver (PANI–Ag) nanocomposite films via an in situ facile UV induced polymerization of aniline in presence of AgNO 3 . The flexible substrates used were (3-aminopropyl)trimethoxysilane (APTMS) modified biaxially oriented polyethylene terephthalate (BOPET) substrates. The APTMS modification of BOPET surface has two advantages: (i) improved adhesion of the films, and (ii) directional growth of polymer perpendicular to the substrate plane, leading to nanobrush-like morphology. The PANI–Ag films have been characterized by various techniques, such as, UV/Vis, FTIR, Raman, SEM and XPS. These films were found to be highly selective and sensitive to the H 2 S i.e. chemiresistive response of ∼100% at 10 ppm with a reasonably fast response time of 6 min. PANI–Ag films prepared on pristine BOPET exhibits chemiresistive response of ∼67% at 10 ppm of H 2 S exposure. In contrast pure PANI films did not exhibit any response on exposure to H 2 S. The plausible mechanism(s) of H 2 S sensing have been discussed. This study highlights the importance of surface modification and the role of Ag in PANI matrix for H 2 S sensing.