Would you be able to explain a bit more about the goal you are trying to solve, with dynamically loading a second widget into your main application? Does this second widget have drastically different dependencies? I'm interested specifically in the part where you need to reload modules. This is where things are going to go wrong. It is one thing to modify the sys.path (which you should still try to avoid at runtime), but reloading is usually something only reserved for debug situations. It definitely does not work correct with compiled extensions like the PySide modules.
On Fri, Jul 27, 2018 at 1:52 AM Juan Cristóbal Quesada < [email protected]> wrote: > Hi, > this is more of a pure python question i want to throw here. > Im developing a PySide Application that is used as the > context/task/app/openfile launcher by the artists. > > The artist makes some choices that drive him towards different dialogs and > widgets. The thing is, due to a request, im facing the need to dynamically > change the sys path and reload all the modules from a different location > inside the same main QApplication. > > The reason for this is that, once an artist makes a specific choice, all > the following widgets... and code that is executed should be loaded from > another location different than the current app. But, should look as if it > were still part of the same app, the widgets need to appear embedded. > > Ive managed to change the sys.path of the original folder to the folder i > want and successfully loaded all the modules from the new path, but then im > starting to get some strange behavior: > > QtCore.QObject.__init__(self) > AttributeError: 'NoneType' object has no attribute 'QObject' > > (Even if performed the from PySide2 import QtCore) > > I understand what im trying to achieve is not very orthodox, i was > wondering if its even possible! > > I would like to avoid obvious ways of separating it in two QApplications > and closing one when the other is opened for example. > > Has any of you ever tried to do something like this? > What concerns should i be aware of when doing it? > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CANOg8wWN-Gwzz-drk79z3C_CMxvLqC_iyCRzRbcH%2BZoAsXMJRw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CANOg8wWN-Gwzz-drk79z3C_CMxvLqC_iyCRzRbcH%2BZoAsXMJRw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA07W7eyZktdSOEgVuAGkO0TFO-bRHkh28fAaQDOB849JQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
