Writing MAVProxy module, how to set waypoints?

Hey all,
I am trying to write a MAVProxy module to communicate with another application I have made. I am struggling to understand how to set waypoints within a module. Looking at the ‘misseditor’ module it seems to be using the ‘wp’ module to set the waypoints, however after attempting to copy sections of code I thought were doing this task it still does not work. The original code in ‘misseditor’ I think is adding waypoints is this:

elif event.get_type() == me_event.MEE_WRITE_WP_NUM:
                w = mavutil.mavlink.MAVLink_mission_item_message(
                    0, 1,
                    event.get_arg("p1"), event.get_arg("p2"),
                    event.get_arg("p3"), event.get_arg("p4"),
                    event.get_arg("lat"), event.get_arg("lon"),


                #tell the wp module to expect some waypoints
                self.mp_misseditor.module('wp').loading_waypoints = True

My code in my module is this below, it does add a point to the map, however it does not save it to the flight controller.

        w = mavutil.mavlink.MAVLink_mission_item_message(0, 0, 1, 10, 16,
                                                      0, 1, 0, 0, 0, 0, -35.372532, 149.163345, 120.000000)

        #tell the wp module to expect some waypoints
        self.module('wp').loading_waypoints = True

Any help would be great. Thanks

I am trying to write a MAVProxy module to communicate with another

If you could put up a minimal copy of your module somewhere I could help
you debug.

One question: are you setting the waypoint count? The block is just
above the me_event.MEE_WRITE_WP_NUM you pasted below…

Thanks Peter. I have uploaded it to GitHub. https://github.com/dell-o/MAVProxy/blob/master/MAVProxy/modules/mavproxy_efls/init.py
No I am not doing that at the moment. I will try that tomorrow and see if it works. Thanks again.