How to check if a certain module is installed

Application Name: Platform Version Number: 2.0.1

Question: We developed a core module based on the legacy ui module.

Now we are developing another module dependent on our core module, and what we want to achieve is to add another section to our core module’s homepage when we install this new module.

And I was thinking that maybe, in order to do this, we need a way to check what modules are installed. Am I in the right direction? If so, how can this be achieved?

Any help would be appreciated! :slight_smile:

You may need to do something like this https://github.com/openmrs/openmrs-module-referenceapplication/blob/master/omod/src/main/resources/config.xml#L24-L58. Take a look at module config file on the wiki https://wiki.openmrs.org/display/docs/Module+Config+File. Also about adding a new section to your modules home page you may want to take a look at https://wiki.openmrs.org/display/docs/Module+Extension+Points.

@markgromantigue if you’re asking how to do this in Java code, you would use something like

Module m = ModuleFactory.getModule("yourmoduleid");
if (m != null && m.isStarted()) { ... }

There’s also a getStartedModules method.

See: https://github.com/openmrs/openmrs-core/blob/2.0.1/api/src/main/java/org/openmrs/module/ModuleFactory.java#L545

Thank you both! These are exactly what I need :smiley: