Loading the right version of gtk modules

PR: [wip] appmenu-gtk-module: init at 0.7.6 by LouisDK1 · Pull Request #95412 · NixOS/nixpkgs · GitHub

In the process of adding a library whjich include appmenu support for gtk-apps (eg. in Plasma, Xfce, Budige or Cinnamon) i stumbled upon an issue where it try to load the gtk2-version of “libappmenu-gtk-module.so” for gtk3-apps.

It’s suspected that it has something to do with GTK_PATH and how matching version of modules gets selected.

Does anyone have an idea on how to solve this?