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

Solution: Import the 'pylons' module

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

 

For more information:
Python pylons