@martinoimp I see some errors:

the call to send_message was not indented for message in messages: send_message(message, media_id) the end quote was not a real quote print ('All messages sent :)') image_url variable does not exist media_id = upload_file(image_url) if image_url else None

After these corrections, the script prints

Sending total messages: 1