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

Solution: Import the 'SCons' module

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

 

For more information:
Python SCons