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

Solution: Import the 'xbmc' module

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

 

For more information:
Python xbmc