# ProjectChangeListener execution order

**URL:** <https://forum.inductiveautomation.com/t/projectchangelistener-execution-order/4978>\
**Category:** Module Development\
**Created:** [August 10, 2012, 2:58pm UTC](https://forum.inductiveautomation.com/t/projectchangelistener-execution-order/4978 "2012-08-10T14:58:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [August 10, 2012, 2:58pm UTC](https://forum.inductiveautomation.com/t/projectchangelistener-execution-order/4978/1 "2012-08-10T14:58:22Z")

</div>

Given two modules A and B:

[ul]

- A stands alone (does not require B)
- B stands alone (does not require A)
- If both A and B are installed, the projectUpdated() event for A must run before the one for B  
[/ul]

How can I enforce this?

Thanks.

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [September 21, 2012, 10:02am UTC](https://forum.inductiveautomation.com/t/projectchangelistener-execution-order/4978/2 "2012-09-21T10:02:38Z")

</div>

Modules can interact with each other via their hook objects using BaseContext.getModule(). It should be possible to setup an appropriate dependency check using this method.

Something like the following should work:

```auto
A.projectUpdated() {
    if (B) {
        // do nothing
    } else {
        A.runUpdate();
    }
}

B.projectUpdated() {
    if (A) {
       A.runUpdate();
    }
    B.runUpdate();
}
```
