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

Solution: Import the 'docx' module

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

import docx

 

For more information:
Python docx