How to set a custom controller code in python

you could have a look at code I posed here.

or the simplified version using graphical setup here.

That’s probably a lot more than you need, it simulates the built in drive code for V5