Why can't I define a macro within a macro and call it?

macro mm(T)
               macro kk()
                   :(println("A")) |> esc
           end |> esc

julia> @macroexpand @mm Int
ERROR: LoadError: UndefVarError: @kk not defined
[1] top-level scope
[2] #macroexpand#32 at ./expr.jl:107 [inlined]
[3] (::getfield(Base, Symbol(“#kw##macroexpand”)))(::NamedTuple{(:recursive,),Tuple{Bool}}, ::typeof(macroexpand), ::Module, ::Expr) at ./none:0
[4] top-level scope at REPL[11]:1
in expression starting at REPL[10]:6

Because the macro needed to be defined in order for the code to be lowered. Therefore, your resulting code must be evaluated first before it can be lowered and evaluated and that’s impossible.

Why do you want to do this.