Making python CLI but C++ codes

I want to make a python CLI. Some part of my backend codes are in python, while some are in C++. I have experience in utilising python codes for CLI, but I donno how to integrate C++ codes here.

So to make things more clear, here is my directory structure.

pyproject.toml
README.md
my tool/
     pycodes/
              code1.py, code2.py, etc.
     cppcodes/
              code3.cpp, code4.cpp, etc.
     main.py
     helper.py
     __init__.py

Now I know how to utilise code1.py, etc. through main.py, very straightforward. But how do I use the cpp codes. Cpp codes are just do some math for me, but I would have to give them input through main.py(or any other way I DONNO about).

Does anyone know how to make this work? can I get some references??

It’s a deep topic - start here: 1. Extending Python with C or C++ — Python 3.12.4 documentation

There are a number of C++ libraries that allow you to expose C++ code to python.

I maintain PyCXX https://cxx.sourceforge.net/ and use it to build the pysvn module https://pysvn.sourceforge.io/

There are other project like bind11 that you should also research.