How to call a zome function from another zome?

Apologies if this is spelled out somewhere, but I couldn’t find it. Is there a way to call a zome function from within another zome?

I tried importing the zome like a crate/mod, but couldn’t get that working:

In message zome, trying to import the records zome:
use records , mod records and extern crate records don’t seem to work.

In cargo.toml for message zome:

[dependencies]
records = { path = "../../records/code/" }

What’s the proper way to do this?

1 Like

Hi @J-Krush try this and see if that works for you:

Use the call function
Enables making function calls to an exposed function from another app instance via bridging, or simply another Zome within the same instance.

View it in the Rust HDK

“Here are two example Zomes, where one performs a call into the other.
This first zome is the “callee”; i.e., the zome that receives the call, and is named summer . because the call sums two numbers.”

Let us know if you need more info.

2 Likes

Puuuuurfect thank you!

1 Like