Warning about unused import & undefined/private function error

The code below throws the error below, and I did not expect that, so I was wondering if this is intended behaviour. If so, how would one define a code structure like this? The idea is to have a module Foo that holds some shared functions, imported into several modules similar to Bar, which are then called from yet another module Baz.

defmodule Foo do
  def foo do
    "bar"
  end
end

defmodule Bar do
  import Foo
end

defmodule Baz do
  def baz do
    Bar.foo()
  end
end

Baz.baz()

$ warning: unused import Foo
$ ** (UndefinedFunctionError) undefined function: Bar.foo/0