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