「Dev:Py/Scripts/Cookbook/Python/Reload」の版間の差分

提供: wiki
< Dev:Py‎ | Scripts‎ | Cookbook‎ | Python
移動先: 案内検索
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 04:40時点における最新版

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)

. .

Blender3D FreeTip.png
Important note
Add the reload code before any other imports (for instance, import bpy). Otherwise, it can fail to register the add-on