It would be better to create a class in C++ and store that pointer in the class itself as private. Then create function calls to access those pointers.
Once the class is implemented generate the .so file of your lib and import it in python. This way you can simply use your C++ code in python and also will not have to save the pointer.
I'm trying to create something and I don't know if it's possible or "clean" :

From python, call function A of my C++ code to compute something complicated
The C++ code returns just the pointer to the python
Do other things in python...
From python, call function B of my C++ code, it takes the pointer and other things as arguments.

I really don't need to use my complicated C++ class in my Python algorithm, that's why I just want to save the pointer in python.
Anyone has any advice on how to do that ?
Edit : In the end I wrapped the c++ class in python, thank you everyone.
How save a C++ pointer in python to pass it again later?