# Writing functions for types defined in another module

**URL:** <https://discourse.julialang.org/t/writing-functions-for-types-defined-in-another-module/31895>\
**Category:** Performance\
**Created:** [December 5, 2019, 10:19am UTC](https://discourse.julialang.org/t/writing-functions-for-types-defined-in-another-module/31895 "2019-12-05T10:19:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [December 5, 2019, 10:44am UTC](https://discourse.julialang.org/t/writing-functions-for-types-defined-in-another-module/31895/2 "2019-12-05T10:44:54Z")

</div>

I think this is a discussion of a similar question:

> [@What is the preferred way to use multiple files?](https://discourse.julialang.org/t/what-is-the-preferred-way-to-use-multiple-files/30687):
>
> I wanted to structure my code by dividing it into several files. But I ran into some problem. So, in its simplest form, I have 3 files: main.jl module main include("structs.jl") include("functions.jl") first\_point = structs.Point(1.5, 1.5) print(functions.distance(first\_point)) end functions.jl module functions include("structs.jl") export distance function distance(point) return (point.x^2+point.y^2)^0.5 end end structs.jl module structs export Point mutable struct Point…

---

_[View the full topic](https://discourse.julialang.org/t/writing-functions-for-types-defined-in-another-module/31895)._
