Dev:Py/Scripts/Cookbook/Python/Reload
< Dev:Py | Scripts | Cookbook | Python
2017年4月4日 (火) 03:35時点におけるwiki>Lijenstinaによる版
To support reload properly, try to access a package var: if it's there, reload everything
For older versions of Python 3 up to 3.4:
if "bpy" in locals():
from imp import reload
if "import_3ds" in locals():
reload(import_3ds)
if "export_3ds" in locals():
reload(export_3ds)
Since Python 3.4, the imp module is deprecated and awaiting removal. Use importlib instead:
if "bpy" in locals():
from importlib import reload
if "import_3ds" in locals():
reload(import_3ds)
if "export_3ds" in locals():
reload(export_3ds)
. .
Important note | |
Add the reload code before any other imports (for instance, import bpy). Otherwise, it can fail to register the add-on |