I understand that we need to add the required function to scip.pyx, and also to scip.pxd. But can someone please explain how to compile these new files?
You just need to make your adjustments and extensions in the code and then install (which includes the compilation step) the updated module as described in INSTALL.md:
python -m pip install .