# \#modules

**URL:** https://discourse.julialang.org/tag/modules/917.md?match_all_tags=true&page=1&tags%5B%5D=modules

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 2

---

## [I put my code into modules, much harder to develop now?](https://discourse.julialang.org/t/i-put-my-code-into-modules-much-harder-to-develop-now/92466)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 4\
**Last updated:** [January 4, 2023, 1:34pm UTC](https://discourse.julialang.org/t/i-put-my-code-into-modules-much-harder-to-develop-now/92466 "2023-01-04T13:34:13Z")

</div>

Hello! Whenever I make a change in a sub-module now I have to restart the entire Julia terminal, for the change to be properly registered in the main script. Is there a way to avoid this? I really like the module struc…

---

## [Purely functional modules](https://discourse.julialang.org/t/purely-functional-modules/89681)

<div class="topic-metadata">

**Author:** [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Replies:** 20\
**Last updated:** [November 24, 2022, 6:10am UTC](https://discourse.julialang.org/t/purely-functional-modules/89681 "2022-11-24T06:10:47Z")

</div>

It seems to me in the data science field some types of modules can be written without modifying any shared state. What if there is a type of module called fmodule that not only cannot modify shared state, but doesn’t al…

---

## [Function conflict with different signatures](https://discourse.julialang.org/t/function-conflict-with-different-signatures/88921)

<div class="topic-metadata">

**Author:** [@RockerM4NHUN](https://discourse.julialang.org/u/RockerM4NHUN)\
**Replies:** 5\
**Last updated:** [October 21, 2022, 8:10am UTC](https://discourse.julialang.org/t/function-conflict-with-different-signatures/88921 "2022-10-21T08:10:34Z")

</div>

Hi! I’m trying to organize a bigger project into multiple modules and I want to create function overloads specific to types found in those modules. Before all my code was in a single module and worked fine, but now my f…

---

## [Exporting from a nested module](https://discourse.julialang.org/t/exporting-from-a-nested-module/87330)

<div class="topic-metadata">

**Author:** [@Jeroen](https://discourse.julialang.org/u/Jeroen)\
**Replies:** 1\
**Last updated:** [September 15, 2022, 6:52pm UTC](https://discourse.julialang.org/t/exporting-from-a-nested-module/87330 "2022-09-15T18:52:36Z")

</div>

Hello, I have a module called MathSolver with another module called Parser inside it. I define a macro @math inside the Parser module, which I want to be available when someone uses using MathSolver. However, I can’t fig…

---

## [Making types available across all submodules](https://discourse.julialang.org/t/making-types-available-across-all-submodules/87125)

<div class="topic-metadata">

**Author:** [@Tharsalys](https://discourse.julialang.org/u/Tharsalys)\
**Replies:** 7\
**Last updated:** [September 12, 2022, 11:05am UTC](https://discourse.julialang.org/t/making-types-available-across-all-submodules/87125 "2022-09-12T11:05:47Z")

</div>

I have a main module and some submodules. Right now, there’s a types.jl in the main module whose types are also required in the submodules. But naturally I can’t make these types accessible in the submodules without incl…

---

## [How to export modules / packages locally?](https://discourse.julialang.org/t/how-to-export-modules-packages-locally/86606)

<div class="topic-metadata">

**Author:** [@hamburger](https://discourse.julialang.org/u/hamburger)\
**Replies:** 10\
**Last updated:** [September 1, 2022, 8:01am UTC](https://discourse.julialang.org/t/how-to-export-modules-packages-locally/86606 "2022-09-01T08:01:50Z")

</div>

How to export modules / packages locally? Hello! I’ve been looking unsuccessfully at how to develop multiple distinct modules locally. My project has three parts: Two modules: TextManipulation, AstroPhysics One Julia…

---

## [How does one initialize data into a module only once?](https://discourse.julialang.org/t/how-does-one-initialize-data-into-a-module-only-once/85775)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 12\
**Last updated:** [August 29, 2022, 3:48pm UTC](https://discourse.julialang.org/t/how-does-one-initialize-data-into-a-module-only-once/85775 "2022-08-29T15:48:37Z")

</div>

I need to load and parse a large file and have that data available before a module is used. I thought to put it in \_\_init\_\_ but discovered it was being called multiple times. module A function \_\_init\_\_() println("Load…

---

## [Difficulties putting code in module (on an M1 machine) (pre-compilation, cfunctions, global variables)](https://discourse.julialang.org/t/difficulties-putting-code-in-module-on-an-m1-machine-pre-compilation-cfunctions-global-variables/84726)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 4\
**Last updated:** [August 12, 2022, 10:12am UTC](https://discourse.julialang.org/t/difficulties-putting-code-in-module-on-an-m1-machine-pre-compilation-cfunctions-global-variables/84726 "2022-08-12T10:12:42Z")

</div>

I’m building an interactive simulation of a Spin Ising model and I’ve been experiencing some difficulties. I’m using QML to build an interface. Before, I had everything in a large script with a lot of global variables, a…

---

## [Using A: B does not put in scope exported B objects](https://discourse.julialang.org/t/using-a-b-does-not-put-in-scope-exported-b-objects/85537)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [August 9, 2022, 2:25pm UTC](https://discourse.julialang.org/t/using-a-b-does-not-put-in-scope-exported-b-objects/85537 "2022-08-09T14:25:10Z")

</div>

For example: julia\> module A module B export f f(x) = 1 end end Main.A julia\> using .A: B julia\> f(1) ERROR: UndefVarError: f not defined Stacktrace: \[1\] top…

---

## [Setting a module global from another module](https://discourse.julialang.org/t/setting-a-module-global-from-another-module/84283)

<div class="topic-metadata">

**Author:** [@arbitrandomuser](https://discourse.julialang.org/u/arbitrandomuser)\
**Replies:** 1\
**Last updated:** [July 15, 2022, 5:58pm UTC](https://discourse.julialang.org/t/setting-a-module-global-from-another-module/84283 "2022-07-15T17:58:01Z")

</div>

I have two packages , lets call them pkgA and pkgB . The sources of the two packages are shown below . module pkgA const glob = \[1,2\] greet() = print("Hello World!") end # module module pkgB import pkgA println("SETT…

---

## [Differences of Core.eval vs. running the code directly in other modules then Main](https://discourse.julialang.org/t/differences-of-core-eval-vs-running-the-code-directly-in-other-modules-then-main/82489)

<div class="topic-metadata">

**Author:** [@sfuerst](https://discourse.julialang.org/u/sfuerst)\
**Replies:** 4\
**Last updated:** [June 9, 2022, 9:27pm UTC](https://discourse.julialang.org/t/differences-of-core-eval-vs-running-the-code-directly-in-other-modules-then-main/82489 "2022-06-09T21:27:47Z")

</div>

While writing the documentation of a package I’m currently developing, I did ran into a problem with Documenter.jl which I could track down to the sandboxing mechanism of Documenter in combination with Core.eval. Withou…

---

## [WARNING: using x.x in module Main conflicts with an existing identifier](https://discourse.julialang.org/t/warning-using-x-x-in-module-main-conflicts-with-an-existing-identifier/80819)

<div class="topic-metadata">

**Author:** [@BrianOConner](https://discourse.julialang.org/u/BrianOConner)\
**Replies:** 7\
**Last updated:** [May 12, 2022, 4:24am UTC](https://discourse.julialang.org/t/warning-using-x-x-in-module-main-conflicts-with-an-existing-identifier/80819 "2022-05-12T04:24:55Z")

</div>

Hi, this is basically my first day with Julia. I know that this question came up a few times in different context, but I did not really think the answers there where helpful. I tried to get random program and run it. I…

---

## [Using struct defined in a different module results in an error](https://discourse.julialang.org/t/using-struct-defined-in-a-different-module-results-in-an-error/78603)

<div class="topic-metadata">

**Author:** [@J4Q8](https://discourse.julialang.org/u/J4Q8)\
**Replies:** 3\
**Last updated:** [March 30, 2022, 9:50am UTC](https://discourse.julialang.org/t/using-struct-defined-in-a-different-module-results-in-an-error/78603 "2022-03-30T09:50:26Z")

</div>

Hi! I am new to julia, so I wanted to try out some code. Everything was nice and clear until I started using multiple scripts. I simplified them to necessary minimum to reproduce error that is bugging me. “trees.jl” m…

---

## [Referencing the same module from multiple files](https://discourse.julialang.org/t/referencing-the-same-module-from-multiple-files/77775)

<div class="topic-metadata">

**Author:** [@knttnk](https://discourse.julialang.org/u/knttnk)\
**Replies:** 2\
**Last updated:** [March 13, 2022, 2:49am UTC](https://discourse.julialang.org/t/referencing-the-same-module-from-multiple-files/77775 "2022-03-13T02:49:43Z")

</div>

Reproducible code I created 3 files like # useful.jl module Useful # issue struct UsefulStruct data end end # create.jl module Create include("useful.jl") function create()::Useful.UsefulStruct Useful.Useful…

---

## [Avoid repeating the same \`using\` line for enclosed modules](https://discourse.julialang.org/t/avoid-repeating-the-same-using-line-for-enclosed-modules/2549)

<div class="topic-metadata">

**Author:** [@xqrongm](https://discourse.julialang.org/u/xqrongm)\
**Replies:** 7\
**Last updated:** [March 8, 2022, 1:28pm UTC](https://discourse.julialang.org/t/avoid-repeating-the-same-using-line-for-enclosed-modules/2549 "2022-03-08T13:28:22Z")

</div>

I want to write modules inside of a module. Is there a way to avoid repeating the same using line of code? module Module0 using Pkg1, Pkg2, Pkg3 module Module01 using Pkg1, Pkg2, Pkg3 some\_code\_1 end module Module02 …

---

## [How best to use a custom module?](https://discourse.julialang.org/t/how-best-to-use-a-custom-module/77066)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 18\
**Last updated:** [March 1, 2022, 10:34am UTC](https://discourse.julialang.org/t/how-best-to-use-a-custom-module/77066 "2022-03-01T10:34:25Z")

</div>

Hi guys, I have been away from Julia since end of 2018. Now coming back and looking at my old code now with Julia 1.7, I feel puzzled at how best to use my own modules. My modules are in subdirectories under the root …

---

## [Subtypes (apparently) not defined within module](https://discourse.julialang.org/t/subtypes-apparently-not-defined-within-module/76669)

<div class="topic-metadata">

**Author:** [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Replies:** 1\
**Last updated:** [February 18, 2022, 3:16am UTC](https://discourse.julialang.org/t/subtypes-apparently-not-defined-within-module/76669 "2022-02-18T03:16:15Z")

</div>

I don’t understand why my function s1type works as expected but the same code coming from MyType module throws a subtypes not defined error. Any thoughts? function s1type(T::DataType) println("type:\\t\\t", T) pri…

---

## [What can't figure out the .. notation in a using statement means?](https://discourse.julialang.org/t/what-cant-figure-out-the-notation-in-a-using-statement-means/75927)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 6\
**Last updated:** [February 7, 2022, 1:02am UTC](https://discourse.julialang.org/t/what-cant-figure-out-the-notation-in-a-using-statement-means/75927 "2022-02-07T01:02:50Z")

</div>

Hi there noob question. I am using vscode to try to figure out the notation in a Pkg. I can’t figure out what the using line does? module Reader using ..Client: read\_one AND if somone could tell me how to figure th…

---

## [How to share a module between several modules](https://discourse.julialang.org/t/how-to-share-a-module-between-several-modules/74645)

<div class="topic-metadata">

**Author:** [@serhii](https://discourse.julialang.org/u/serhii)\
**Replies:** 12\
**Last updated:** [January 17, 2022, 4:56pm UTC](https://discourse.julialang.org/t/how-to-share-a-module-between-several-modules/74645 "2022-01-17T16:56:53Z")

</div>

Hi, Sorry for the noob question. I have a utility module that I would like to share between two other modules. As far as I understand, simply using include("whatever/path/UtilityModule.jl") followed by using .UtilityMod…

---

## [Need help understanding best practices to organise projects with many scripts](https://discourse.julialang.org/t/need-help-understanding-best-practices-to-organise-projects-with-many-scripts/68683)

<div class="topic-metadata">

**Author:** [@fieldofnodes](https://discourse.julialang.org/u/fieldofnodes)\
**Replies:** 1\
**Last updated:** [January 11, 2022, 7:41pm UTC](https://discourse.julialang.org/t/need-help-understanding-best-practices-to-organise-projects-with-many-scripts/68683 "2022-01-11T19:41:13Z")

</div>

Hi all, This is a general question, which could be asked in a broader arena, but I wanted to see what people do to keep projects organised. I often, with the best of intentions, start with a clean basic template of fol…

---

## [Why the global variable is not updated even already initialized and included in all modules?](https://discourse.julialang.org/t/why-the-global-variable-is-not-updated-even-already-initialized-and-included-in-all-modules/66704)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 12\
**Last updated:** [August 20, 2021, 7:44pm UTC](https://discourse.julialang.org/t/why-the-global-variable-is-not-updated-even-already-initialized-and-included-in-all-modules/66704 "2021-08-20T19:44:51Z")

</div>

Sorry for another stupid question again. First of all, I am not proud of using global variables. My question is very simple. Three modules, A, B, and C, they are in A.jl, B.jl, C.jl. I have defined an array called mus…

---

## [Organization of multiple modules in same package](https://discourse.julialang.org/t/organization-of-multiple-modules-in-same-package/17287)

<div class="topic-metadata">

**Author:** [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Replies:** 18\
**Last updated:** [May 4, 2021, 6:01am UTC](https://discourse.julialang.org/t/organization-of-multiple-modules-in-same-package/17287 "2021-05-04T06:01:48Z")

</div>

I’m developing a package which defines a number of types. Some types are helpers and some are specific implementations (parametric or abstract) of other types from this package. I’ve been poking around popular packages…

---

## [Single module vs. submodules in a project](https://discourse.julialang.org/t/single-module-vs-submodules-in-a-project/55361)

<div class="topic-metadata">

**Author:** [@erans](https://discourse.julialang.org/u/erans)\
**Replies:** 17\
**Last updated:** [February 17, 2021, 12:14am UTC](https://discourse.julialang.org/t/single-module-vs-submodules-in-a-project/55361 "2021-02-17T00:14:49Z")

</div>

I have been reading a fair amount (a few references at end of post) about how to “correctly”, or better yet idiomatically, structure code in Julia. In general, there seems to be a strong sentiment that many submodules pr…

---

## [Organizing local Julia code into modules and/or packages](https://discourse.julialang.org/t/organizing-local-julia-code-into-modules-and-or-packages/48350)

<div class="topic-metadata">

**Author:** [@Niclas\_Wiberg](https://discourse.julialang.org/u/Niclas_Wiberg)\
**Replies:** 7\
**Last updated:** [October 14, 2020, 11:30am UTC](https://discourse.julialang.org/t/organizing-local-julia-code-into-modules-and-or-packages/48350 "2020-10-14T11:30:13Z")

</div>

I’m trying to understand how to best work with local julia modules. Our project is in C++ but we use Julia for testing, partly because it is convenient to generate and verify the complex input/output data we are dealing…

---

## [How to Import dependency from one file to another inside of a package?](https://discourse.julialang.org/t/how-to-import-dependency-from-one-file-to-another-inside-of-a-package/42891)

<div class="topic-metadata">

**Author:** [@DataPsycho](https://discourse.julialang.org/u/DataPsycho)\
**Replies:** 8\
**Last updated:** [July 23, 2020, 4:18pm UTC](https://discourse.julialang.org/t/how-to-import-dependency-from-one-file-to-another-inside-of-a-package/42891 "2020-07-23T16:18:56Z")

</div>

Hi, I am writing a package in Julia. But can not figure it out how to import some particular function from one file to another. Here is the latest version of the package: https://github.com/DataPsycho/ProjectFlow.jl Let…

---

## [Question on package vs modules](https://discourse.julialang.org/t/question-on-package-vs-modules/42196)

<div class="topic-metadata">

**Author:** [@jiggunjer](https://discourse.julialang.org/u/jiggunjer)\
**Replies:** 5\
**Last updated:** [June 30, 2020, 2:37am UTC](https://discourse.julialang.org/t/question-on-package-vs-modules/42196 "2020-06-30T02:37:02Z")

</div>

I’ve read the official documentation on packages and modules, but I get the impression the two concepts get conflated. Can someone say if the following statements are true or false, and if false then why: A single Gith…

---

## [Large programs: structuring modules & include such that to increase performance and readability](https://discourse.julialang.org/t/large-programs-structuring-modules-include-such-that-to-increase-performance-and-readability/29102)

<div class="topic-metadata">

**Author:** [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Replies:** 14\
**Last updated:** [October 4, 2019, 9:43am UTC](https://discourse.julialang.org/t/large-programs-structuring-modules-include-such-that-to-increase-performance-and-readability/29102 "2019-10-04T09:43:59Z")

</div>

I am writing a large hydrological model for which I require to divide the program in many modules incorporated in individual files. I am questioning what will be an efficient and readable approach to share the modules a…

---

## [Pros & Cons of using modules vs plain include?](https://discourse.julialang.org/t/pros-cons-of-using-modules-vs-plain-include/14694)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 14\
**Last updated:** [September 8, 2018, 12:46pm UTC](https://discourse.julialang.org/t/pros-cons-of-using-modules-vs-plain-include/14694 "2018-09-08T12:46:00Z")

</div>

I would like to understand the two ways of structuring and running scripts: put the scripts in modules, and use ‘using MyModule’ to run them; not put the scripts in any module, and use ‘include(“myfile.jl”)’ to run the…

[Previous page](https://discourse.julialang.org/tag/modules/917.md?match_all_tags=true&tags%5B%5D=modules)
