How to invoke a python module in bitbake recipe?

I am working on a linux open-embedded project (Yocto), and I need to use gRPC.

Below are my recipes that try to invoke the gRPC python module. (grpcio-tools)

In local.conf

TOOLCHAIN_HOST_TASK_append = " nativesdk-python3-grpcio-tools"
TOOLCHAIN_TARGET_TASK_append = " python3-grpcio-tools"

Then is my .bb file, I try to add it as Depends.

DEPENDS += " python3-grpcio-tools"
   python3 -m grpc_tools.protoc -I ${S} --python_out=. --grpc_python_out=. ${S}/tests/rcu_ser.proto

But it fails to find the python module during bitbake. Below is the failure code:

Please teach me how to invoke the python module during bitbake.

Thank you very much.


inherit python3native

DEPENDS += " python3-grpcio-tools-native"

and it works !

Thanks very much!