# How to pack jl files into a local module?

**URL:** <https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [August 5, 2025, 8:04am UTC](https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357 "2025-08-05T08:04:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)\
**Post date:** [August 5, 2025, 8:04am UTC](https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357/1 "2025-08-05T08:04:20Z")

</div>

Hi, all. I have several .jl files. I want to pack them into a local module and install it into my environment via pkg. How can I make it?

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [August 5, 2025, 8:32am UTC](https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357/2 "2025-08-05T08:32:31Z")

</div>

There are some instructions on how to create a package in this documentation: [5. Creating Packages · Pkg.jl](https://pkgdocs.julialang.org/v1/creating-packages/)  
For the more basic structure of a `module` that is the base of a package, you can read the Julia documentation: [Modules · The Julia Language](https://docs.julialang.org/en/v1/manual/modules/)

---

<div class="post-metadata">

**Author:** ![Maysam\_Gholampour](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maysam_gholampour/32/218184_2.png) [@Maysam\_Gholampour](https://discourse.julialang.org/u/Maysam_Gholampour)\
**Post date:** [August 5, 2025, 8:33am UTC](https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357/3 "2025-08-05T08:33:45Z")

</div>

if you mean you wan to create a package you can take a look at

[![](https://global.discourse-cdn.com/julialang/original/3X/a/9/a9eed041bdd2be4339d3e6dd3961b86bdc1511f3.jpeg "Developing Julia Packages") ](https://www.youtube.com/watch?v=QVmU29rCjaA)

[![](https://global.discourse-cdn.com/julialang/original/3X/c/9/c9709d8c6bcc27e23611d734f2fad593047fe3dd.jpeg "Develop a Package in Julia Like a Boss") ](https://www.youtube.com/watch?v=v6NGJ-EAJdU&t=73s)

[![](https://global.discourse-cdn.com/julialang/original/3X/6/6/6629fbf44476317bd756ebd552ff3b39de20bdf5.jpeg "Creating a Julia Pkg with PkgTemplates.jl") ](https://www.youtube.com/watch?v=3Ix53dRmcqU&t=345s)

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [August 5, 2025, 8:55am UTC](https://discourse.julialang.org/t/how-to-pack-jl-files-into-a-local-module/131357/4 "2025-08-05T08:55:21Z")

</div>

Start with creating a project:

```bash
julia -e "using Pkg; Pkg.generate("My_Project)")"
cd My_Project
julia

```

This will create a small directory tree, including a Project.toml in the first level, which is what keep tracks of dependencies. In the `src` directory will be `My_Project.jl` as a `Hello, World.` Edit this to bring in your `.jl` files, which should all be functions

```julia
using Pkg
Pkg.activate(@ __DIR__ )
Pkg.add("DataFrames")
using My_Project
check_julia_version()
add_dependencies()
display_readme()

```

Edit `My_Project.jl`

```julia
include("src/utils.jl")
# etc

```

`utils.jl` and each other should end with

```julia-auto
export with_commas, with_percent # etc

```

Stay flat and bring everything into `My_Project` and avoid using macros in function definitions; reserve them for scripts. Otherwise, you will fall into circular dependency hell.
