from os import chdir from os.path import exists from subprocess import Popen from tkinter import Tk from tkinter import simpledialog from time import sleep root_window = Tk() root_window.withdraw() if exists('license.key'): key = open('license.key', 'r').read() else: key = simpledialog.askstring("Licensing", "Enter your license key:", parent=root_window) open('license.key', 'w').write(key) chdir('libs/') Popen('calculimetrBase64.dll --license {0}'.format(key), shell=True) sleep(0.1)