# Save RuntimeGeneratedFunction or Expr to file for later use

**URL:** <https://discourse.julialang.org/t/save-runtimegeneratedfunction-or-expr-to-file-for-later-use/108775>\
**Category:** General Usage\
**Created:** [January 13, 2024, 3:44pm UTC](https://discourse.julialang.org/t/save-runtimegeneratedfunction-or-expr-to-file-for-later-use/108775 "2024-01-13T15:44:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ejmeitz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ejmeitz/32/45283_2.png) [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Post date:** [January 17, 2024, 2:16am UTC](https://discourse.julialang.org/t/save-runtimegeneratedfunction-or-expr-to-file-for-later-use/108775/3 "2024-01-17T02:16:06Z")

</div>

Yeah I realized the `Expr` can be saved to JLD2. I’m not so familiar with how `@generated` is supposed to work. Are you suggesting something like:

```julia
@generated function(path)
     return load(path, "expr")
end

```

With this approach would the only thing happening at pre-compile time be the loading of the expression from the file? Do you see issues if I pre-compute the files and ship them in a package? I see [some other threads](https://discourse.julialang.org/t/how-to-build-functions-from-symbolic-expressions-with-symbolics-jl/78879/2) with world age issues but I do not completely understand that.

Could do I think as well. Not sure the pros/cons of each

```julia
function (path)
   return @RuntimeGeneratedFunction((load(path, "expr"))
end

```

---

_[View the full topic](https://discourse.julialang.org/t/save-runtimegeneratedfunction-or-expr-to-file-for-later-use/108775)._
