# Having Problems when creating an app

**URL:** https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141
**Category:** New to Julia
**Tags:** question, package
**Created:** [October 18, 2023, 10:21pm UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141 "2023-10-18T22:21:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gugong](https://avatars.discourse-cdn.com/v4/letter/g/ed655f/32.png) [@gugong](https://discourse.julialang.org/u/gugong)
#### Post date: [October 18, 2023, 10:21pm UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141/1 "2023-10-18T22:21:42Z")

</div>

Hello, I am haivng problems when converting my code into an exe file. While I have to use isdefined function to check if there is an variable in my main environment such as ’ if isdefined(:term\_symbol)', and the packagecompiler could not create an module let this fucntion to check, which eventually get the error message as: ‘head not found’. But this phrase is necessay for the rest of my code, is there any way to let exe run successful?

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [October 19, 2023, 6:25am UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141/2 "2023-10-19T06:25:20Z")

</div>

Hello @gugong, and welcome to the Julia community!

I’m afraid you haven’t given enough details for us to get started with.

Do I get it correctly that you are trying to compile a Julia script into an executable? AFAIK, to use `PackageCompiler`, you have to put all your code inside a module, and compile that module as a package. In theory, there shouldn’t be any issues with compiling `isdefined` calls, so I’m guessing that you’re attempting to check if a symbol is defined in a toplevel call in the `Main` module. While this works from the REPL, it won’t work as expected when compiled, because at the time of compilation, it’s not. I’m unsure about the specific error message you get. Please provide more context.

---

<div class="post-metadata">

### Author: ![gugong](https://avatars.discourse-cdn.com/v4/letter/g/ed655f/32.png) [@gugong](https://discourse.julialang.org/u/gugong)
#### Post date: [October 19, 2023, 6:40am UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141/3 "2023-10-19T06:40:51Z")

</div>

Thank you very much! Here is the details of my works:

I am trying to use julia to run this part of code which use a package called JWAS, and what I am doing is just put everything into a module and it seems that the function I used from JWAS uses the **isdefined(main, symbol)** (and **getfield** ) and I try to modify this **main** into the module of the module named as **MyModule** containing my function and everything. But the exe shows the error message that **MyModule not found**. I am currently thinking of move the related function from JWAS into my main function in order to solve that question.

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [October 19, 2023, 6:55am UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141/4 "2023-10-19T06:55:43Z")

</div>

I briefly checked the source code of `JWAS.jl`, and it indeed [checks for symbols defined in the `Main` module](https://github.com/reworkhow/JWAS.jl/blob/1b577024d672903fc091c5aa51bbdbc8cc7b4928/src/1.JWAS/src/build_MME.jl#L100). At first glance, this seems like a poor design decision on behalf of the `JWAS.jl` developers, because it appears to limit its use to the `Main` module only. I could be wrong, though, I haven’t tried to use it myself.

Anyhow, in this case, the problem appears to caused by putting your own logic inside a module (or rather, the fact that `JWAS.jl` isn’t prepared for that), not by using `PackageCompiler`. I’m afraid I’d have to have a more in depth knowledge of `JWAS.jl` to figure out how to do this properly.

---

<div class="post-metadata">

### Author: ![gugong](https://avatars.discourse-cdn.com/v4/letter/g/ed655f/32.png) [@gugong](https://discourse.julialang.org/u/gugong)
#### Post date: [October 20, 2023, 3:22am UTC](https://discourse.julialang.org/t/having-problems-when-creating-an-app/105141/5 "2023-10-20T03:22:00Z")

</div>

I found a new way to solve my question already, which is transfer my data into the function as a parameter. I think it will work, I will let you know the updates. Thank you very much！
