Amorphous carbon films with an intermediate content of sp3 atoms are finding applications as resistive switches in devices for bio-sensing and for neuromorphic pattern recognition. To understand resistive switching and photoconductivity in amorphous semiconductors dominated by hopping conduction, we present a theory that unifies the optical and electronic properties. The theory considers all of the states to be localized to various extents instead of being extended electronic states. The electronic density of states (eDOS) is modeled with Gaussian functions, symmetric in energy around the Fermi energy. A "hopping mobility"between localized states that is explicitly both energy and temperature dependent is introduced. We describe an example application to amorphous carbon films prepared by using high power impulse magnetron sputtering that have a range of sp3 hybridization fractions of the carbon atoms. The electronic bandgaps of the films are observed to correlate with their optical bandgaps. The eDOS is benchmarked against optical property measurements made by ellipsometry. The theory explains the temperature dependence of the resistivity and predicts that the films should show a temperature dependent hopping photoconductivity. Measurements confirm the presence of the photoconductivity and reveal its spectral dependence. A link is made between persistent hopping photoconductivity and resistive switching.