The title says it all. I am cleaning up python scripts I have written. Sometimes in the writing of scripts I have tried out one library only to replace it, or not use it later. 
I would like to be able to check if a library which is imported is actually used within the script later. Ideally i would do this without having to comment out the import line and run it looking for errors each time. 
Does anyone know of a resource or script/library which checks for this? Or what about other tips for cleaning up script to share with others? 
Thanks, 
Mike
Try a Python linter, they will do this for you, for example flake8. Install with pip install flake8 and run by calling flake8 in the root folder of your project.
How can I check if an imported library is 'used' in a python script?