How to correctly reload the Blender2Babylon script

Hi!
I’m using Blender 2.82a
Blender2Babylon exporter script 6.4.1

I’d like to try customizing the script but I’m getting an error when I try to reload the script. I have no experience writing add-ons for Blender so that may not be helping.

To reproduce the error:
Give the default cube a node material with Vertex Color feeding Base Color
Try exporting to .babylon (it should work)
Then hit F3 and search ‘reload scripts’ to reload scripts
Try exporting again
Get this error

Traceback (most recent call last):
File “C:\Users\melsov\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js_init_.py”, line 67, in execute
exporter.execute(context, self.filepath)
File “C:\Users\melsov\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\json_exporter.py”, line 115, in execute
mesh = Mesh(object, scene, self)
File “C:\Users\melsov\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\mesh.py”, line 146, in init
recipe = BakingRecipe(bpyMesh, exporter)
File “C:\Users\melsov\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\materials\baking_recipe.py”, line 100, in init
self.bakedMaterial = BJSMaterial(firstMatUsingNodes, exporter)
File “C:\Users\melsov\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\materials\material.py”, line 62, in init
self.bjsNodeTree = AbstractBJSNode.readMaterialNodeTree(bpyMaterial.node_tree)
AttributeError: ‘BJSMaterial’ object has no attribute ‘node_tree’

location: :-1

Thanks for any help!

Adding @JCPalmer the Blender exporter daddy to the discussion.

Any time that I re-install the zip file, must be a thousand time by now, I EXIT Blender and restart before testing. Not sure about editing the addon file directly. Python and many interpreters have problems getting updated source reloaded while running.

I would cycle while you dev, otherwise you can spend much more time trying to fix problems which do not actually exist.

1 Like

Thanks for the quick response (and the awesome exporter by the way)!
I was tempted to think that you had a way of avoiding quitting, re-zipping, restarting because of a comment regarding reloading modules in the top level init.py–but I guess all those ‘imp.reload()’ calls do something else.

Yeah, still not sure how much time I want to sink into learning Blender scripting.
But that makes sense: the interpreter doesn’t want source updated mid session…