Script works if I run it in blender, but not as an addon

Hello, I’m trying to use this script so that Blender will save my external images upon saving the .blend file, but it doesn’t work when I try to install it as an addon.

If I copy paste the script into Blender and run it as a script it works as intended, but if I install it as an addon and enable it it doesn’t. If I close and reopen Blender it still shows the addon as enabled.

Any ideas why it doesn’t appear to be loading the script on startup in Blender?

It has been a while since I have played around with plugins, but check to make sure you do not have identically named files in the folders you are using, remove all of the old files, back them up somewhere else so you know for sure that you are using the file that you think you are using. If that does not get it, I would look for a plugin that works and compare the coding, see what is different in your coding that might influence how yours behaves.

Have you set the script to be an addon

Its not actually a script I made, but one I found (guess I forgot to actually include it):

I copied this into a .py file and added it into blender through the addons tab of properties.

bl_info = {
“name”: “Auto-save external images”,
“author”: “CoDEmanX”,
“version”: (1, 0),
“blender”: (2, 67, 0),
“location”: “”,
“description”: “Save image datablocks on saving .blend”,
“warning”: “Works on external images only!”,
“wiki_url”: “”,
“category”: “System”}

import bpy

def save_external_images(dummy):
for img in

def register():

def unregister():

if name == “main”: register()

Hmmm, so it works when i first add it to blender as an add-on, but not upon restarting blender.