0
$\begingroup$

I am very new to Blender. Exploring it i have found a scripting template called "Addon Add Object". When i open and run it i see as much menu entries in the Add>Mesh menu as i ran the script.

Steps to reproduce my problem:

  1. open the Scripting view
  2. Click on Templates>Python>Addon Add Object
  3. Click on button "Run Script"
  4. in 3d View open the Add>Mesh menu and see a new entry named "Add Object"
  5. repeat step 3.
  6. in 3d View open the Add>Mesh menu and see another entry named "Add Object" AND the previous one is not removed.

As far as I understood the script, in line 88 the menu entry should be removed, but it is not.

Is that an error?

Did i miss something?

How can i remove the obsolete menu entry then?

I tried to find an answer myself, but the problem is so specific, that i did not know what to search for in Google.

$\endgroup$
0
$\begingroup$

If you run from the main thread, via the text editor the "addon" is only registered (the if __name__ == "__main__" bit). Doing this is for testing purposes, and is not meant to be a way to run addons.

To remove, go to python console and type in

bpy.ops.scripts.reload() 

the shortcut for which prior to 2.8 is F8

When an addon is enabled, it is imported as a module and the register method is called. When addon is disabled the module's unregister method is called.

Addons are designed to be enabled and registered via the addons in user prefs, or by putting in scripts folder, or by making it a registered script in the text editor.

Related: unregistering a class

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.