0
$\begingroup$

First a small background story; I'm currently new into python development and I am teaching it myself on a hands on project. I'm developing an add-on in Blender 4.0 and sofar it goes all well (thanks to ChatGTP).

Now about the problem I have, where I could not find any good answer for. It's more of a workflow question. I have an UI module, and each button in the UI is it's own module. Additionally I have a global functions module and this is where I'm facing some inconveniences. I'm importing the functions in the beginning of my module, f.e. like this:

from .functions import get_last_node, check_selected_objs

And when I pack the add-on into a .zip file and install it in Blender, it works flawlessly. However it does not work if I run the module in the script editor. I get following error.

ImportError: attempted relative import with no known parent package

The way I'm working right now is; do changes in modules, remove add-on from blender, restart, repack .zip file with up to date files & install add-on again and see if my changes worked. I doubt this is the best way, there must be a way to modify my modules inside Blenders Script Editor, no?

I appreciate any help on this topic and say thanks in advance.

$\endgroup$

1 Answer 1

1
$\begingroup$

You don't need to go back and forth with a .zip file. Just open the addon folder like scripts\addons\my_addon with a better editor like https://code.visualstudio.com/ and edit there.

Also try the extension: https://marketplace.visualstudio.com/items?itemName=JacquesLucke.blender-development It has a function to start Blender with the addon enabled, reloading and debugging.

$\endgroup$
1
  • $\begingroup$ Thank you that was exactly it. For people who might come across this in the future, here is a how to video on connecting VSCode with Blender: youtube.com/watch?v=YUytEtaVrrc $\endgroup$
    – STRGnine
    Commented Jan 10 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .