# Is there a way to make module in anon workspace & then ingest it into a package?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-make-module-in-anon-workspace-then-ingest-it-into-a-package/7909>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 22, 2017, 2:13am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-module-in-anon-workspace-then-ingest-it-into-a-package/7909 "2017-12-22T02:13:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [December 22, 2017, 2:13am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-module-in-anon-workspace-then-ingest-it-into-a-package/7909/1 "2017-12-22T02:13:54Z")

</div>

The idea is you create a module – `Foo` – in some anonymous workspace.

// i.e. in order to not have to overwrite the module if it fails

```julia
module _anon_uuid

    module Foo

       if rand() < 0.5
          bar() = "Hello, World."
       else
          error("Explode")
       end

    end

end

```

* * *

Is there a way to then inject this encapsulated module into some other Module?

in psuedocode:

```julia
module Fizz

  cur_module = parse(<string_representation_of_module>)

  cur_sub_module = nothing

  for cur_attempt in 1:10
    try
      cur_sub_module = @make_encapsulated_module cur_module
    catch
      include("hot_fix_$(cur_attempt).jl")
      continue
    end

    break
  end

  ( cur_sub_module == nothing ) && error("nothing worked!")

  @ingest_module cur_sub_module

end

```

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [December 24, 2017, 9:38am UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-module-in-anon-workspace-then-ingest-it-into-a-package/7909/2 "2017-12-24T09:38:46Z")

</div>

There is a lot of code here that is not definend e.g. `@make_encapsulated_module` or `@ingest_module`, so I don’t fully understand your question or what you intend to do.

I presume that `@ingest_module` gives you the module `_anon_uuid`?

What about simply doing a `import _anon_uuid: Foo`?
