[SofaPython3/Plugin] Restore the automatic reload of modules#182
Conversation
|
It was flaggued ready by @fredroy but it emits a deprecation message from a python library...so i prefer to update the code to remove it before mergin. EDIT: ok so the warning was about using a python2 library in the embedded code. Now this code is replaced with python3 version. |
…vironment-cleaning # Conflicts: # Plugin/src/SofaPython3/PythonEnvironment.cpp
37283ab to
c59fe01
Compare
As they are not operating in the same python namespace.
| } | ||
| getStaticData()->m_sofamodule = py::module::import("Sofa"); | ||
|
|
||
| PyRun_SimpleString("import SofaRuntime"); |
There was a problem hiding this comment.
Because as far as I can see it is not the same behavior and the existing py::module is not working as expected.
The difference is that the py::module version is importing something in a standalone context, accessible from c++ and not importing a module it into the current interpreter context.
For consistency I used the same function as other part of the code to do that as in
PyRun_SimpleString("from Sofa.livecoding import onReimpAFile");|
@damienmarchal |
|
Thanks for reporting, I'm looking at it. |
it is important when reloading a scene to force python to reload all the loaded modules to be sure the context is as clean as possible.
This PR restore this mechanism and clean the duplicated code from between SofaRuntime and Sofa