I'm working on a small post-save-hook, which is working pretty nicely only if the file is saved first and then the script is loaded later on. If I install my addon from the file and I save the currently opened new blender project I have this error:
AttributeError: '_RestrictData' object has no attribute 'filepath'
Which comes from the line, where I try to access the filepath data of my blender file:
path = bpy.data.filepath
When I remove my script, save the blender file and then readd my script it works again. So basically my question is:
What is the workaround of this issue? Can an already loaded module reload itself? Or is there some other way to do this properly?
Thanks in advance!
from .. import .. as ..was a micro optimisation -- as it is working quite well for python modules, reduces the number of look ups as it is adding the exact value to the global name space. Thanks! – Peter Varo Apr 19 '14 at 21:56__init__.pyand add thebpy.app.handlers.save_post.append(foobar)line to thedef register()function – NumesSanguis Mar 14 '21 at 07:08