Provide external functions as TVMScript?

I tried a simple program:

import tvm
from tvm.ir.module import IRModule
from tvm.script import tir as T
import numpy as np

def foo(A):
    A[0] = 2.0

@T.prim_func
def main(a: T.handle):
    T.func_attr({"global_symbol": "main", "tir.noalias": True})
    A = T.match_buffer(a, (5,), "float32")
    tvm.tir.call_packed("foo", A)

if __name__ == "__main__":
    mod = IRModule.from_expr(main)
    f = tvm.build(mod, target="llvm")
    a = tvm.nd.array(np.array([1, 2, 3, 4, 5], dtype=np.float32), device=tvm.cpu())
    f(a)
    print(a.numpy())

But got the error:

error: Internal Error: function must be of type Intrin, ScopeHandler or SpecialStmt, but it is function
    |  
 13 |      tvm.tir.call_packed("foo", A)
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Inlining foo manually instead of using tvm.tir.call_packed works.

Am I using call_packed incorrectly? Do I need to convert A to some other type before passing it?