We cannot prevent you to instantiate module widgets but you should not do that, as they are not designed to work well when you create multiple instances. Also, a module widget has node selectors for all its inputs/outputs, so there would be always several node redundant node selectors when you integrate a module widget in your own module’s GUI.
If you want to reuse widgets from a module then use the same high-level widgets that are in the other module and use the other module’s logic. If you find that there is logic (algorithm, complex scene manipulations, etc.) in the other module’s widget that you would like to use then that other module has to be refactored so that all reusable logic is in its module logic class (which is designed to be reusable from other modules).
Also note that many features of Endoscopy module is already available in curve markups and soon Endoscopy module will be fully written to take advantage of that and remove duplication between these modules.
What I am going to do is open the endoscopy and markups in one time by slicer’s python interactor. But when I click the mani windows of slicer, the window of endoscopy will run in background(hidden by slicer main window). Slicer seems to not detect the ‘widget’ of endoscopy was open as will as me? So,some times,too many windows(all endoscopy windows) were open for me.
I don’t understand what you are planning to do exactly but it seems quite complex and not how the modules are supposed to be used. Your module should have its own GUI (do not try to hijack other module’s GUI) and use other module’s logic. To implement GUI of your module, you can of course have a look at other module’s GUIs and use similar widgets but then copy only those widgets that are relevant for your workflow and with a layout that is optimal for your workflow.