How to Solve NameError: name 'readline' is not defined

Solution: Import the 'readline' module

# Add the following line to the top of your code
import readline

 

For more information:
Python readline