# Object paths across julia modules

**URL:** <https://discourse.julialang.org/t/object-paths-across-julia-modules/108195>\
**Category:** General Usage\
**Created:** [December 30, 2023, 8:11pm UTC](https://discourse.julialang.org/t/object-paths-across-julia-modules/108195 "2023-12-30T20:11:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomaskroi1996](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thomaskroi1996/32/49392_2.png) [@thomaskroi1996](https://discourse.julialang.org/u/thomaskroi1996)\
**Post date:** [December 30, 2023, 8:11pm UTC](https://discourse.julialang.org/t/object-paths-across-julia-modules/108195/1 "2023-12-30T20:11:32Z")

</div>

Hey everyone!

I am currently developing a package and I have encountered a small problem. Imagine the following situation.

I have a module1 and module2, full of functions and a module3 full of objects/structs. This is all encapsuled in a package. Now, in module1 and module2 there are functions that return objects defined in module3!

When i want to use my package, and for the sake of simplicity, just want to compare the objects, i get an error that there is no conversion function found for objects of type module1.module3.Object to module2.module3.Object.

In my code i want to set an object i get from module1 to one that i got from module2! However, i would like to avoid running a loop! Is there a way to do this? Or a better module structure of defining the object in a global way, where it will always be just package\_name.object?

Thank you for all the help in advance!

With kind regards,  
Thomas

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 30, 2023, 8:37pm UTC](https://discourse.julialang.org/t/object-paths-across-julia-modules/108195/2 "2023-12-30T20:37:07Z")

</div>

It sounds like you’ve used `include` to evaluate the file twice, which results in two separate and distinct copies of the inner module existing, which isn’t what you want. You’ll want to include the module a single time and then reference that single copy from both places.

---

<div class="post-metadata">

**Author:** ![thomaskroi1996](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thomaskroi1996/32/49392_2.png) [@thomaskroi1996](https://discourse.julialang.org/u/thomaskroi1996)\
**Post date:** [January 4, 2024, 6:49pm UTC](https://discourse.julialang.org/t/object-paths-across-julia-modules/108195/3 "2024-01-04T18:49:15Z")

</div>

Thanks so much! That was something I didn’t understand about how submodules communicate!
