- Ensure that all necessary Python files and dependencies are included within the custom library. This includes any modules, scripts, or additional files that are required for the Python functionality. If any dependencies are missing, it can lead to the need for re-importing files.
- Verify that the paths to the imported Python files and any related dependencies are correctly configured within the custom library. Incorrect paths or missing references can lead to the need for re-importing files.
- If you have made changes to the Python code or its dependencies, make sure to update the custom library to reflect these changes. This can involve re-packaging the library to include the latest versions of the imported files.
- Refer the following documentation to reload modified user-defined python module: https://in.mathworks.com/help/matlab/matlab_external/call-user-defined-custom-module.html#buuz303
Python imported library blocks don't work after a restart.
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have imported a python code into a simulink block, and everything works as desired at first. When I restart Matlab, I can still find my library in the library browser, but the block does not work anymore. The error I get is:
Error:MATLAB System block 'Testfile/LibName_Blockname' error occurred when invoking 'setupImpl' method of 'Elementreplacer_VolumeMixer'.
Caused by:
Invalid HandleObjectRef - Entry not found in the server table
when I import the python file again with obj.view, it works again (Untill a restart). Is it possible to keep the file imported? I have to import multiple python files, so having to import them manually every time, is not very efficient.
0 comentarios
Respuestas (1)
Tushar Sharma
el 5 de Dic. de 2023
Hi Bastiaan,
If you are experiencing the need to re-import all the files every time you use the custom library, it may indicate that the imported Python functionality is not being fully encapsulated within the custom library. To address this issue, consider the following suggestions:
Also, you may consider going through the following documentation which provides an overview of using Python Importer to implement Python modules or packages in Simulink: https://in.mathworks.com/help/simulink/ug/import-python-code-using-python-importer.html
Hope it helps!
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!