If you are seeing this error, you are trying to run an python application using python 3.5.x version. ‘secrets’ module was only available from python 3.6.x versions.
So you might need to install higher python version and start using them. You will not see this error on those python versions
sudo apt-get install python3.6
Or
sudo apt-get install python3.7