--
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 python_inside_m...@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.
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.
Try using importlib or impAlthough, as Justin has already pointed out, it is not recommended to use reload in production code or to dynamically append/insert paths in sys.path.Give more thought to the design and architecture of your app. A good design should handle dependencies in a more elegant and efficient manner. A possible design idea would be this - If you are already aware of all the path that the app might need during runtime, load them up at boot time and use them later. Do note the fact that python modules are first class object i.e they can be used as a variable, can be dynamically created, passed and returned from a function. Use this for your design.- Alok
On Fri, Jul 27, 2018 at 7:00 AM Justin Israel <justin...@gmail.com> wrote:
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 <juan.cri...@gmail.com> 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 python_inside_maya+unsub...@googlegroups.com.
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.
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 python_inside_maya+unsub...@googlegroups.com.
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.
----
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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMRzu_d9%2BtP-b1fJawQ8DGYVHDmcW3FeXmb4%3DEEMU72D5g%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
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.
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 python_inside_m...@googlegroups.com.
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.
--
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMRzu_d9%2BtP-b1fJawQ8DGYVHDmcW3FeXmb4%3DEEMU72D5g%40mail.gmail.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANOg8wUTtSzaZMSTzUG9QcBCa5wGu6x%3DQPHzqAwzo%2Bm5%3DRe7%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I think you'd be better served with a small launcher app. That allows for the artist to make their selection.Then that opens the proper app from the proper location.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
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.
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 python_inside_m...@googlegroups.com.
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.
--
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMRzu_d9%2BtP-b1fJawQ8DGYVHDmcW3FeXmb4%3DEEMU72D5g%40mail.gmail.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a62f74ac-9d78-469b-81c5-2a780577df87%40googlegroups.com.