Kernel.apply/3 exception

Kernel.apply/3 keeps throwing this exception. I’m trying to dynamically run a module name + def from a map string field.

MathOperators.multiplier(event, inputs)

works however


In Elixir, Module names are actually prefixed with “Elixir” – You can see this in IEx:

iex(18)> Atom.to_string(MyModule)

So, the error is technically correct – “MathOperators” as a module doesn’t exist, but “Elixir.MathOperators” does!

The Module concat/1 and concat/2 functions can help alleviate this problem for you:

So, instead of, String.to_atom("MathOperators"), try: Module.concat(["MathOperators"]) :slight_smile:


ahah that worked thank you good sir. I knew it was something easy and now I know :stuck_out_tongue: