From what I can find this appears to be an issue with what Blender allows access to at the time the addon loads. Posts such as this:
Suggest that access is restricted due to the the problem with cross functional addons. That makes sense, and I understand the restriction. What I can't find is how to work within that limitation.
In my situation the addon is really an overlay application that user will only run this one thing. So I actually do want to modify the working environment for the whole application. In this instance changing from metric to imperial units. I've tried two ways and both give the same error:
bpy.context.scene.unit_settings.system = 'IMPERIAL' bpy.data.scenes["Scene"].unit_settings.system = 'IMPERIAL'
How can I make this change from an addon perspective? No matter how it's done this is a global change (at least from a scene perspective) and is going to affect other addons anyway.