Unable to load C++ Class with multiclass Python HL
|
|
---|---|
Hello, The low-level API allows adding a C++ class via the add_class() method, and the high-level API requires using run() which does not support this feature. Could you please confirm for me that it is indeed impossible to have a multi-class python server that loads both HL python class and C++ class (shared lib)? And in case of impossibility, could you tell me if it is planned that this functionality be added? Thanks for your help, Arnaud |
|
|
---|---|
Hi Arnaud I think it might be possible to mix C++ classes with high-level API devices. You will have to use the tango.Util class directly. This is a singleton, so if we use add_class before calling tango.server.run, then it should see all the classes. The tango.server.run function is adding the Python classes internally. Based on the example here: https://pytango.readthedocs.io/en/v9.3.5/howto.html#multiple-device-classes-python-and-c-in-a-server (note: the example above has a typo on line 5 - it should be "util =", not "py =".)
There is also a dict form that can be passed to run for more complicated settings, but this still doesn't allow a C++ class to be specified. It may be useful to extend the dict-form to suit your use case. Please let me know if the suggested code works or fails. /Anton |
|
|
---|---|
Thank you very much Anton, it works fine with this syntax. I did a basic test in a Conda environment with pytango 9.3.3.
This allows great flexibility in the use of Python multiclasses Arnaud |
|
|
---|---|
Thanks, Arnaud. That's good news. It would be great if you could propose a documentation update for PyTango, so others can find this in future. Fixing, and extending this section: https://gitlab.com/tango-controls/pytango/-/blob/v9.3.5/doc/howto.rst#L790-815 /Anton |