# Test if a module is a child of another module

**URL:** <https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 14, 2019, 2:56pm UTC](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346 "2019-07-14T14:56:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tencnivel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tencnivel/32/8662_2.png) [@tencnivel](https://discourse.julialang.org/u/tencnivel)\
**Post date:** [July 14, 2019, 2:56pm UTC](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346/1 "2019-07-14T14:56:19Z")

</div>

Hello,

On the following example, how would you test if a module has another module as a parent or grand parent?

```julia
module MyModule
    module MySubModule
             module MySubSubModule end
    end
end

```

NOTE: I would prefer a solution that doesn’t compare the names of the modules because I’m worried that it would not be robust

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [July 14, 2019, 3:09pm UTC](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346/2 "2019-07-14T15:09:11Z")

</div>

`parentmodule`?

---

<div class="post-metadata">

**Author:** ![tencnivel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tencnivel/32/8662_2.png) [@tencnivel](https://discourse.julialang.org/u/tencnivel)\
**Post date:** [July 14, 2019, 3:53pm UTC](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346/3 "2019-07-14T15:53:36Z")

</div>

thanks! I’ll make a utility function that uses `parentmodule` and that will do 👍
