# Error: PythonModuleBuilder . def\_method

**URL:** <https://forum.modular.com/t/error-pythonmodulebuilder-def-method/2653>\
**Category:** Mojo\
**Created:** [January 30, 2026, 2:02am UTC](https://forum.modular.com/t/error-pythonmodulebuilder-def-method/2653 "2026-01-30T02:02:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedmoore](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/tedmoore/32/912_2.png) [@tedmoore](https://forum.modular.com/u/tedmoore)\
**Post date:** [January 30, 2026, 2:02am UTC](https://forum.modular.com/t/error-pythonmodulebuilder-def-method/2653/1 "2026-01-30T02:02:06Z")

</div>

Greetings,

I’ve just updated to 0.26.2.0.dev2026012905 (from 0.25.7) and now I’m getting this error when trying to use the PythonModuleBuilder.

```mojo

/Users/ted/dev/MMMAudio/ManyOscillatorsBridge.mojo:219:13: error: invalid call to ‘def_method’: failed to infer parameter ‘method_type’
.def_methodMMMAudioBridge.next

```

The code is below. VSCode is suggesting an error on the line: `.def_method[MMMAudioBridge.next("next")` `

The error occurs on whatever line the first `.def_method` occurs so it seems the error is with that “invalid call” as suggested by the error above. I looked at the changelog but couldn’t see what would have changed to be causing this error.

Thanks for any help or suggestions!

```mojo
@export
fn PyInit_ManyOscillatorsBridge() -> PythonObject:
    try:
        var m = PythonModuleBuilder("MMMAudioBridge")

        _ = (
            m.add_type[MMMAudioBridge]("MMMAudioBridge")
            .def_py_init[MMMAudioBridge.py_init]()
            .def_method[MMMAudioBridge.next]("next")
            .def_method[MMMAudioBridge.set_screen_dims]("set_screen_dims")
            .def_method[MMMAudioBridge.update_mouse_pos]("update_mouse_pos")
            .def_method[MMMAudioBridge.update_bool_msg]("update_bool_msg")
            .def_method[MMMAudioBridge.update_bools_msg]("update_bools_msg")
            .def_method[MMMAudioBridge.update_float_msg]("update_float_msg")
            .def_method[MMMAudioBridge.update_floats_msg]("update_floats_msg")
            .def_method[MMMAudioBridge.update_int_msg]("update_int_msg")
            .def_method[MMMAudioBridge.update_ints_msg]("update_ints_msg")
            .def_method[MMMAudioBridge.update_trig_msg]("update_trig_msg")
            .def_method[MMMAudioBridge.update_trigs_msg]("update_trigs_msg")
            .def_method[MMMAudioBridge.update_string_msg]("update_string_msg")
            .def_method[MMMAudioBridge.update_strings_msg]("update_strings_msg")
            .def_method[MMMAudioBridge.send_raw_hid]("send_raw_hid")
            .def_method[MMMAudioBridge.set_channel_count]("set_channel_count")
        )

        return m.finalize()
    except e:
        abort(String("error creating Python Mojo module:", e))

```

---

<div class="post-metadata">

**Author:** ![spluta](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@spluta](https://forum.modular.com/u/spluta)\
**Post date:** [January 31, 2026, 3:20pm UTC](https://forum.modular.com/t/error-pythonmodulebuilder-def-method/2653/2 "2026-01-31T15:20:37Z")

</div>

We were able to figure this out. The entire PythonModuleBuilder syntax changed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [July 30, 2026, 3:21pm UTC](https://forum.modular.com/t/error-pythonmodulebuilder-def-method/2653/3 "2026-07-30T15:21:17Z")

</div>

Closed on July 30, 2026, 3:21pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
