s-a / ToBlender

Use any external text editor with Blender 🐵
MIT License
42 stars 3 forks source link

ModuleNotFoundError #2

Open brupelo opened 4 years ago

brupelo commented 4 years ago

Hi, I'd love to give it a shot to your cool package but I've faced already some issues on blender 2.82.7, pls take a look to this little test

Here's the steps i've followed:

Traceback (most recent call last):
  File "D:\software\blender\blender-2.82a-windows64\2.82\scripts\modules\addon_u
tils.py", line 351, in enable
    mod = __import__(module_name)
ModuleNotFoundError: No module named 'test'

Could you pls advice?

Also... each time it's reloading is making a new client connection

showcase

is this intended?

xixixao commented 1 year ago

You need to pass full file path to the --reload argument.

That said the current addon code uses exec, here's a better version using module loading:

dir = os.path.dirname(cmd)
if dir not in sys.path:
    sys.path.append(dir)
__import__(os.path.basename(os.path.splitext(cmd)[0])).main()

This allows you to import any blender module like bmesh.