# Parsing non-Core types from a config file

**URL:** <https://discourse.julialang.org/t/parsing-non-core-types-from-a-config-file/14652>\
**Category:** General Usage\
**Tags:** module\
**Created:** [September 7, 2018, 6:26am UTC](https://discourse.julialang.org/t/parsing-non-core-types-from-a-config-file/14652 "2018-09-07T06:26:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jocklawrie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jocklawrie/32/33616_2.png) [@jocklawrie](https://discourse.julialang.org/u/jocklawrie)\
**Post date:** [September 7, 2018, 6:26am UTC](https://discourse.julialang.org/t/parsing-non-core-types-from-a-config-file/14652/1 "2018-09-07T06:26:16Z")

</div>

Hi all,

I’m having some trouble with the code below.

I am writing a module that contains a function taking a `String` input (from a config file) and returns a `DataType`. The function aims to parse the string to a `DataType`. For example, `f("UInt8")` returns `UInt8`.

The function works for Core types, such as `UInt8` and `Float64`.  
But it throws an error when parsing a non-core type because the module that defines the function hasn’t imported the type.

How can I get this to work without importing all possible types into the module that defines the function?

```julia
module mymod1
    export f

    f(s::String) = eval(Meta.parse(s))
end

module mymod2
    using mymod1
    using TimeZones

    f("Float64") # Float64
    s = "TimeZones.ZonedDateTime"
    println(eval(Meta.parse(s))) # OK
    f(s) # Error
end

```
