Error when import AOT compiled function in other njit function

Firstly, I compiled a AOT function named “spd” ( .so file: spd_module.cpython-39-x86_64-linux-gnu.so). Then I want to use spd function in other @njit function like code below:

from spd_module import spd
@njit
def test():
arr = np.random.normal(0, 1, (100, 100))
return spd(arr)

it went wrong with:

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name ‘spd’: Cannot determine Numba type of <class ‘builtin_function_or_method’>

好人一生平安。

I also encountered a problem like yours. May I ask if there is a proper solution to this problem? Thanks.

Does the example in the docs work for you?

Thanks.
Not exactly. AOT was finished and work well. But as I moved this module into another function, it broke down and returned an error message. I found a similar problem on this page
feature_request. So right now, it seems not to be solved soon.
My code is attached below.

I’m just starting to understand the problem. I read the linked issue. I don’t have a solution.

This thread may or may not be useful for fashioning a solution.

I don’t know of any workaround for this at the moment. You’re best bet is to use njit(cache=True) for now. However, it seems like the devs will be moving toward better portability/cross-linking support in numba in the future. But, I wouldn’t be surprised if there was a solution to this in a year or two: Proposal: Numba 2023 MVP

It make sense!!! Hope coming soon