Export imported functions

Hi there,

is there a way to make functions available on a module, which have just been imported?

defmodule Say do
  def hello do
    "Hello"
  end
end

defmodule Greeting do
  import Say
end

# Is there a way to get this?
Greeting.hello
** (UndefinedFunctionError) function Greeting.hello/0 is undefined or private
Greeting.hello()

See this topic: Warning about unused import & undefined/private function error, you can use use or defdelegate, probably better to use defdelegate.

2 Likes