0Pricing
Mojo Academy · Lesson

Passing Mojo Data to Python

Hand values across the interop bridge.

Crossing the Bridge

To use a Python library, your Mojo values must cross into Python first. That hand-off is the heart of interop. 🌉

Numbers Convert

Mojo numbers turn into Python numbers automatically when you pass them. A Mojo Int becomes a Python int the library can read.

var n = 42
var result = np.array([n])

All lessons in this course

  1. Using NumPy from Mojo
  2. Passing Mojo Data to Python
  3. Reading Python Objects Back
  4. Interop Performance Gotchas
← Back to Mojo Academy