Pywikibot is a Python-based framework to write bots for MediaWiki (more information).
Once an image has been copied with imagecopy.py and a sysop account is configured for that wiki, we should provide an option to delete the image.
You need to add a new param in scripts/imagecopy.py. Then add at the end of the process, after the import on Wikimedia Commons, add a check that verifies if the new param was enabled and if the user has sysop rights, then delete the old picture.
You are expected to provide a patch in Wikimedia Gerrit. Documentation on Gerrit is available.