We investigate a process of controlling the electronic properties of a surface of nanoporous carbon glass-like thin films when the surface pores are filled with potassium atoms. The presence of impurities on the surface in the form of chemically adsorbed hydrogen and oxygen atoms, and also in the form of hydroxyl (OH) groups, is taken into account. It is found that even in the presence of impurities, the work function of a carbon nanoporous glass-like film can be reduced by several tenths of an electron volt when the nanopores are filled with potassium atoms. At the same time, almost all potassium atoms are ionized, losing one electron, which passes to the carbon framework of the film. This is due to the nanosizes of the pores in which the electron clouds of the potassium atom interact maximally with the electrons of the carbon framework. As a result, this leads to an improvement in the electrical conductivity and an increase in the electron density at the Fermi level. Thus, we conclude that an increase in the number of nanosized pores on the film surface makes it possible to effectively modify it, providing an effective control of the electronic structure and emission properties. © 2020 by the authors.