The entire script can be split into 4 modules named train_mnist.py, training_plots.py, GAN.py and train_gan.py. Store these in a folder of your choice, say 'gan'. Set gan as the project folder in your favorite source code editor and just run the file train_gan.py.
The train_gan.py python file will import functions from all the other modules in places where needed for execution.
Now let's walk through the contents of each file.