PyObject* PyImport_ImportModule( const char *name)
How to specify a full file path instead and a module name?
Like PyImport_SomeFunction(const char *path_to_script, const char *name)
.
Another solution for cases when all *.py file are in one directory:
PySys_SetPath("path/with/python/files");
PyObject *pModule = PyImport_ImportModule("filename_without_extension");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With