If you ‘uncheck’ a loaded Extension and then ‘check’ that Extension again, then it doesn’t reload, it’s already loaded.
You will need to force the ‘load’ - as explained below…
Let’s say you extension is named ‘SuperWidget.rb’, it has a subfolder named ‘SuperWidget’.
In there is a file named ‘SuperWidget_code.rb’ which is what the Extension [say it’s named ‘SuperWidget’] which is set up in ‘SuperWidget.rb’ loads.
When ‘SuperWidget.rb’ is loaded [as Sketchup starts] it makes the Extension ‘SuperWidget’, and checks for its ‘state’.
If it’s ‘checked’ in loads ‘SuperWidget_code.rb’ - making menus etc.
If you ‘uncheck’ it later on [manually OR in code] then it cannot ‘unload’ its contents/menus etc - it’s not [readily] possible in the way Ruby works.
So the ‘SuperWidget’ Extension remains loaded, although is now ‘unchecked’.
If you now ‘check’ it [manually or in code] then nothing happens as SketchUp has already loaded the Extension’s code and it knows it.
If you have ‘unchecked’ its Extension, then when SketchUp restarts it does not load ‘SuperWidget.rb’ - no menus are made etc.
If however, if it was initially ‘unchecked’ but you then ‘checked’ it [manually or in code] then SketchUp sees that the Extension is not yet loaded, and so it then loads it.
To force a “reload” of your code whilst testing do not try to:
It will not do anything if its code is primarily involved in its Extension set up: rather use:
Loading this WILL reload that file’s code.
Unless you have correctly used
file_loaded in that file’s menu creation code you will get duplicate menu entries created when you load it again.
You cannot add to a preexisting menus once SketchUp has started.
However, new menu can/will be created when code is [re]loaded unless a
file_loaded trap is used.
You will not get/see additional buttons in existing toolbars, irrespective of the
file_loaded set up.
You may get duplicated toolbars, if you have changed the ‘name’ of the toolbar in the loading code.