Macro does not like module attribute?

If I understand your code correctly it tries to find an attribute in the calling module and use it in the macro.

I think my scenario is a bit different - I’m trying to pass a value to the macro, and it’s not always a module attribute either. I typically call it like this:

defstruct_module(State, [:some, :fields])

If I understand what you’re doing, it might be possible to match for “module attribute” in a separate head for the same macro and then use Module.get_attribute/3 and call the other Macro head with it?

We tried Macro.expand(param, __CALLER__) and it remained nil.

If you meant something else, please let me know.