That’s not really the cleanest way of doing things in Julia. Julia has multiple dispatch - so you can just define the same method multiple times for different data types - and generate different data types depending on user config.
Basically it’s best to try to use simple methods and the type system before you use metaprogramming or some kind of code loading trick. You may want to do some reading and exploration of types. Direct transfer of python idioms will be a lot less successful than re-imagining the code in the context of having an amazing type system and multiple dispatch that python simply doesn’t have.