def upload_by_mail(pictures, mail_list): """Gather mail list, send task to upload.""" addresses = [] print(mail_list) # Mail can be activated but not mapped to this button if len(mail_list) > 0: print("mail list has mails in it") for mail_num in mail_list: addresses.append(get_key(mail_num, "address")) print("after action") send_mail(addresses, pictures) else: print("Mail activated but no mails choosen on this button") print("after mail upload")