How to Solve NameError: name 'currentframe' is not defined -- inspect

Solution: Import the 'currentframe' module

To Solve the error, add the following line to the top of your code.

from inspect import currentframe

 

For more information:
Python inspect currentframe