How to properly call alias Aaa.Bbb.Ccc for a template?

In my template I have to call a method using its full name:

<%= MyApp.Aaaa.Bbbb.Module1.method1() %>

even though I’ve already called an alias on it in the corresponding View:

defmodule MyApp.MyModelView do
  alias MyApp.Aaaa.Bbbb

Why isn’t “alias” working here?

<%= Bbbb.Module1.method1() %> <!-- exception -->

I’ve not tested, but mine are set up this way, are the aliases ‘before’ the use ... lines in your View?

No aliases before

As I understand it, you need to have alias before use in this case, that the code injected by use is able to see them.

1 Like

I’ve done so – nothing has changed, the error remains

Could you please post some detailed code?

View, template and module you are calling into through the alias. Also please provide the exact error message you see.