# Executing code blocks with REPL workspace

**URL:** <https://discourse.julialang.org/t/executing-code-blocks-with-repl-workspace/107572>\
**Category:** General Usage\
**Created:** [December 13, 2023, 3:51pm UTC](https://discourse.julialang.org/t/executing-code-blocks-with-repl-workspace/107572 "2023-12-13T15:51:31Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [December 15, 2023, 6:54pm UTC](https://discourse.julialang.org/t/executing-code-blocks-with-repl-workspace/107572/14 "2023-12-15T18:54:14Z")

</div>

Some combination of the following is helpful to me

1. An exportall(mod::Module)` function

```julia
function exportall(mod)
    for n in names(mod, all = true)
        if Base.isidentifier(n) && n ∉ (Symbol(mod), :eval)
            @eval mod export $n
        end
    end
end

```

I have this in my startup.jl

1. A `main()` function inside the module which looks like

```julia
function main()
@eval Main begin
    ...
end
end

```

The only problem is that you need to make sure you run `exportall` before `main()`

This has a nice combination of

1. Revise.jl works
2. You can play around with functions inside your module
3. The temporary variables you make at the REPL aren’t visible inside your module, so you don’t accidentally define global things that get used in your module.

---

_[View the full topic](https://discourse.julialang.org/t/executing-code-blocks-with-repl-workspace/107572)._
