Is it possible to access a widget class element from the test class in a slicer plugin? I know this is not how the test class works but I am controlling the logic functions with an extra variable taht indicates if the call from the widget class or from the test class.
widg = slicer.modules.myModule.widgetRepresentation()
wObjs = [x for x in widg.children()[1:] if x.windowTitle =="mainCollapsibleBtn"][-1].children()
#getting the classes information
for x in wObjs[1:]:
print(x.className())
#endfor x
By getting the classes information one can access the desirable class e.g.
Slicer releases all references to the old widget, but if you keep references to it then it will not be destroyed. It is a debug/development feature anyway, so you don’t need worry about old widgets hanging around (if it becomes to confusing then just restart the application), but it makes sense to at least remove all observers in the widget’s cleanup() method.
By the way, you should never ever need to use children() or findWidget on your own module’s GUI. You have direct access to all widgets (something like module.xyz.widgetRepresentation().self().ui.abcWidget, if you follow the current Python scripted module template).