def Copy_exit(button,choice): ####called when user selects copy to clipboard pyperclip.copy(str(choice.url)) spam = pyperclip.paste() sys.exit()