# How to export programatically-generated variables from a module

**URL:** <https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118>\
**Category:** General Usage\
**Tags:** metaprogramming, module\
**Created:** [September 24, 2019, 4:26pm UTC](https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118 "2019-09-24T16:26:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [September 24, 2019, 4:26pm UTC](https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118/1 "2019-09-24T16:26:51Z")

</div>

There might be a much simpler solution to this that doesn’t even involve metaprogramming, but what I’m trying to do is generate some variables within a module that will hold data frames and then make those variables available from the file that’s calling the function that generates the data frames:

```julia
# modules/create_dataframes.jl
module CreateDataFrames
using CSV, DataFrames
export create_dataframes

function create_dataframes(filepaths::Vector{String})
    for (ind, file) in enumerate(filepaths)
        dfname = Symbol("df$ind")
        @eval $dfname = CSV.read($file, normalizenames = true, ignoreemptylines = true, copycols = true)
    end
end

end

# /app.jl
include("modules/create_dataframes.jl")
using .CreateDataFrames

filepaths = ["path/to/file1.csv", "path/to/file2.csv"]

create_dataframes(filepaths)

```

If I move the `create_dataframes` function out of the module and into app.jl, it works just fine. However, I don’t want this function to live inside of app.jl as I have some other related functions that I want to keep in a separate file. Is there some way to export a programatically-generated variable from within a module?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 24, 2019, 6:52pm UTC](https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118/2 "2019-09-24T18:52:45Z")

</div>

> [@mthelm85](#):
>
> might be a much simpler solution to this that doesn’t even involve metaprogramming

I would put them in a `Dict`, and just modify/export that.
