Use when NameError from Python is thrown by your code

A NameError is one of Python's built-in exceptions:

exception NameError

Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found.