## 2 Experimental Section
### Measurements  
Both \({}^{1}\)Hand\({}^{13}\)C nuclear magnetic resonance (NMR) spectra were recorded with a Bruker Advanced AV 3 HD (400 MHz) spectrometer and a Bruker AV 3 HD (500 MHz) spectrometer at room temperature using chloroform-d (CDCl\({}_{3}\)), acetone-d\({}_{6}\) (CD\({}_{3}\)COCD\({}_{3}\)) or dimethyl sulfoxide-d\({}_{6}\) (CD\({}_{3}\)SOCD\({}_{3}\)). With the Bruker AV 3 HD (500 MHz) spectrometer, the \({}^{1}\)H NMR spectra for the polymers were recorded in 1,1,2,2-tetrachloroethane-d\({}_{2}\)(C\({}_{2}\)D\({}_{2}\)Cl\({}_{4}\)) at 100 \({}^{\circ}\)C. The chemical shifts were recorded in parts per million (ppm). The coupling constants (J) were measured in Hertz (Hz). Both \({}^{1}\)H and \({}^{13}\)C NMR spectra were investigated using Bruker Top Spin 3.2 software. The PerkinElmer 2400 Series II CHNS/O Elemental Analyser or Vario MICRO Cube CHN/S Elemental Analyser were used to perform the elemental analysis (CHN). Schoniger oxygen flask combustion technique was conducted to analyze anions such as Br, I and S. The mass spectra of the monomers were registered on an Agilent 7200 (Q-TOF GC-MS) accurate mass spectrometer. As a carrier gas, helium was used at the rate of 1.2 mL min\({}^{-1}\) with an injection volume of 1.0 \(\mu\)L, and a measured sample concentration of 5 mg mL\({}^{-1}\) in CHCl\({}_{3}\) solvent. The temperature was programmed to vary from 60 to 320 \({}^{\circ}\)C at a rate of 10 \({}^{\circ}\)C min\({}^{-1}\). The electron ionization method (EI) provided mass spectra for the monomers. Gel permeation chromatography (GPC) tests were conducted with the Viscotek GPC Max and water 410 instruments with a detector of a differential refractive index, two Polymer Labs PLgel 5\(\upmu\) Mixed C columns (7.5 \(\times\) 300 mm), and a guard of 7.5 \(\times\) 50 mm. Using high-pressure liquid chromatography (HPLC)-grade CHCl\({}_{3}\), molecular weights for the polymers were measured by preparing polymer solutions of 2.5 mg mL\({}^{-1}\). The columns were thermostated using CHCl\({}_{3}\) at 40 \({}^{\circ}\)C. UV-vis absorption spectra were studied at room temperature with a SPECORD S600 UV/visible spectrophotometer. Polymer absorbance was carried out in CHCl\({}_{3}\) solution using quartz cuvettes (optical path length 10 mm), including the CHCl\({}_{3}\) solution. The blank quartz cuvette was first taken as a background reference. The polymers were coated with CHCl\({}_{3}\) solutions (1 mg mL\({}^{-1}\)) on quartz substrates, and the blank quartz substrate was used as a reference. The PerkinElmer (Pyris 1) thermogravimetric analyser was used to perform the thermogravimetric analysis (TGA) measurements. As a sample holder, platinum pans were used, and the samples were weighted to be around 3 mg. Cyclic voltammograms were carried out by a Princeton Applied Research 263A Potentiostat/Galvanostat. Based on a Pt disk working electrode, a typical three-electrode system was used. A silver wire reference electrode (Ag/Ag\({}^{+}\)) was placed in 0.01 M of AgNO\({}_{3}\) solution in acetonitrile and mounted in the electrolyte solution. During all measurements at room temperature, a Pt wire counter electrode was purged with an argon atmosphere. Tetrabutylammonium perchlorate in acetonitrile (0.1 M, Bu\({}_{4}\)NClO\({}_{4}\)/CH\({}_{3}\)CN) was employed as the electrolyte.  
For the casting of the polymer thin films, the polymer solutions were measured in CH\({}_{3}\)Cl (1 mg mL\({}^{-1}\)) onto the Pt disk and dried under nitrogen before measurements were taken. As a reference redox system, ferrocene (Fc/Fc\({}^{+}\)) was used. The Bruker D8 ADVANCE X-ray powder diffractometer was used to measure powder X-ray diffraction (XRD). Infrared absorption spectra were determined by the ATR PerkinElmer Rx/FT-IR and Nicolet Model 205 FT-IR spectrometers.