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

Solution: Import the '_ast' module

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

 

For more information:
Python _ast