knife_project in python
You walked in right direction, but the code should be wrapped in operator execution method, register and call it from Operator Search using chosen view.

I've made this gist from operator_simple.py template, it works from object or edit mode with active object as target and other as knifes.
https://gist.github.com/Begalov/763688551b49004d92ef227ddd7694d6