How to Solve NameError: name 'UserList' is not defined -- collections
Solution: Import the 'UserList' module
To Solve the error, add the following line to the top of your code.
from collections import UserList
For more information:
Python collections UserList