Importing C++ functions created with pybind11 I am currently trying to create a C++ library with pybind11. My .cpp-file is a simple test and looks like this:
#include &lt;pybind11/pybind11.h&gt;

namespace py = pybind11;

std::string test()
{
    return &quot;Test successful!&quot;;
}

PYBIND11_MODULE(TreeGenModule, m)
{
    m.def(&quot;test&quot;, &amp;test);
}

Opening a Python interactive console I can import my compiled module and use the test-function.
However when importing the module from within a Blender-addon I'm trying to write, I can import the module itself but the interpreter cannot find any of the defined functions.
Any ideas why this error occurs?

EDIT:
Here's what happens if I navigate to the folder of my module and import the module using an interactive python session:
Python 3.7.9 (default, Nov 20 2020, 02:21:39) 
[GCC 10.2.0] on linux
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import TreeGenModule
&gt;&gt;&gt; TreeGenModule.test()
'Test successful!'

However, if I try the same import from within my module and invoke TreeGenModule.test():
AttributeError: module 'TBO_Tree_Gen.cpp_bin.TreeGenModule' has no attribute 'test'
So after some digging I found out, that this was caused by importlib.reload.
Blenders Reload Scripts-command only reloads the addon if the main file (in my case __init__.py) has been changed. (Also discussed here)
Since my addon consists out of several .py-files and I wanted everything to be reloaded if I hit the command, I used importlib.reload to manually force reloading.
I also used this technique on my C++-module, which you're not supposed to do!
Reloading C++-modules with importlib is not supported and may result in errors, just like in my case.
After removing this reloading instruction my C++-module works just fine in Blender. The only downside is, that I'll have to restart Blender, whenever I change my C++-module and want to see these changes in effect.