In this tutorial, you'll learn everything you need to know about Python modules - from basic imports to creating your own modules.
The basic question here is how to pass a MicroPython object to a C function in a custom C module. In this case a PWM object.