5.6. Updating your instrument plugin for PyMoDAQ 4

5.6.1. What’s new in PyMoDAQ 4

The main modification in PyMoDAQ 4 concerning the instrument plugins is related to the hierarchy of the modules in the source code, see What’s new in PyMoDAQ 4.

5.6.2. What should be modified Imports

Mostly the only things to be modified are imports that should reflect the new package layout. This includes import in obvious files, for instance imports in the DAQ_Move_template plugin, see Fig. 5.70.


Fig. 5.70 New imports

Some imports are a bit more insidious. Indeed, often there is no specific code in the __init__.py files we see everywhere in our modules. But in the plugins, there is a bit of initialization code, see for instance Fig. 5.71 so make sure you changed the imports in all these __init__.py.


Fig. 5.71 New imports hidden in the __init__.py files

And that’s it, they should be working now!


If your instrument plugin has been written from a recent version of the template (say early 2023) then the only __init__.py file to be modified is the one in figure Fig. 5.71 but otherwise you’ll need to modify most of them…sorry :-( Data emission

But to make things very neat, your detector instrument plugins should emit no more lists of DataFromPlugins objects but a DataToExport emitted using new signals, see Emission of data. Requirements

And for the final bit, make sure to add a dependency to pymodaq >= 4.0.0 in the package requirements, see Fig. 5.72. With this, the Plugin Manager will know your plugin is compatible and will propose it to installation.


Fig. 5.72 Requirements necessary so that the Plugin Manager know your plugin is compatible with PyMoDAQ 4.