Is it possible to use 3rd party python packages/subpackages from within Matlab? (as opposed to 3rd party modules)
I have a package ("mypackage") for python2.7. I installed it in a conda environment (using conda 4.9.2) and have verified I can run its modules from a Python console. The package has two subpackages: "modelA" and "modelB". Each subpackage holds a module named "run" that holds various commands for the relevant model.
I would like to be able call the two different "run" modules from within a Matlab script (Matlab 2020b). The ideal would be something like:
I've added "mypackage" to both the Python and Matlab search paths, and have tried moving the working directory to the folder holding "mypackage", but I always get the error: "Unable to resolve the name py.mypackage.modelA.run.foo".
I have been able to run a module successfully by moving the working directory to "...\mypackage\modelA", and then calling
However, if I then try moving to "...mypackage\modelB" and calling
I get another "Unable to resolve the name" error. My best guess is that the Python search path is still pointing to the "run" module for modelA, as I am still able to call py.run.foo. If this is the case, is it possible to remove a module from the Python search path in order to toggle between modules?