How to Solve NameError: name 'Popen' is not defined -- subprocess
Solution: Import the 'Popen' module
To Solve the error, add the following line to the top of your code.
from subprocess import Popen
For more information:
Python subprocess Popen