How to call a Python function from C++ on Ubuntu 20.04

Add this in your main function after Py_Initialize();

PySys_SetPath(L".:/usr/lib/python3.8");

this is the search path for python module. Add . to search in the current path.