Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError #2

Open
brupelo opened this issue Apr 23, 2020 · 1 comment
Open

ModuleNotFoundError #2

brupelo opened this issue Apr 23, 2020 · 1 comment

Comments

@brupelo
Copy link

brupelo commented Apr 23, 2020

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:

  • Installed the provided addon on blender 2.82.7
  • Restarted blender
  • Create script at d:\foo\test.py and run cd d:\foo && toblender --reload test.py (also tried with toblender --reload test.py --watch d:\foo\test.py)
  • Got error:
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
Copy link

xixixao commented Oct 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants