Trouble using QInputDialog.getText

Thanks, Rob, for your reply. It led me to the answer. For some reason, when I run the code I get no error message, the script just terminates without comment. When I typed your error message into a Google search box it took me to “Error "Widget: Must construct a QApplication before a QWidget" - #2 by Mholscher” where in July 2021 Percy and Menno Holscher discuss this very same issue on this very same forum. After reading them, I added one line to my code (app = QApplication()) and now it works perfectly. (Note that my code already included " from PyQt5.QtWidgets import * " whereas Percy specifies . . . import QApplication among others.)