How to import a macro to init.py

Hi everyone,

i have four scripts i wanted to bundle into one. I made an init.py file and imported them. The one that is a standard operator (NP_shader_brush) is imported well, appears in the new panel and works. The other three that are macros appear in the panel but don’t work. I think the problem is their macro.definitions are missing in the init.py and i don’t know how to import them. Any ideas? They all work as independend scripts.

Attachments

NP_set_009.zip (20.7 KB)

Just a bump, in case someone has an idea…

It should work by calling the other modules register functions from the register function in init.py

Like this:


def register():
    [...]
    NP_float_box_009.register()    
    NP_float_tube_009.register()                                                        
    NP_float_cone_009.register()
    NP_shader_brush_009.register()

Thanks for the tip Ryker, i will let you know if i make any progress…

Issue is indeed in the register function.

Thing is, all classes should be registered from the main module (i.e. init.py file), sub-modules register() only do the extra initializing work then.

Attached archive below is working for me.

NP_set_009.zip (20.9 KB)

Thanks mont29, you nailed it! That is it!

I actually tried something similar, only without bpy.utils.register_module(name) in front / or making surplus code which made collisions with already registered classes… Great!
Ryker, you also had a valid remark, i just didn’t know how to complete it. I couldn’t find anyone who bundled macros before…

Thank you very much guys!