Imp.load_dynamic failing from the escripting console

Hello,

Can the experts help me to solve the following mystery?.
I have a 3rd party lib, which I have installed in /var/lib/ignition/user-lib/pylib/ following the advices of the documentation. It is called dimc.py which uses a dimc.so also placed at the same area. The code of dimc.py is just:
def bootstrap():
global bootstrap, loader, file
import sys, pkg_resources, imp
file = pkg_resources.resource_filename(name,‘dimc.so’)
loader = None; del bootstrap, loader
imp.load_dynamic(name,file)
bootstrap()

BTW, I have not created it, I just deploy it because I want to use it for another things, and it has been used as it is by my community since years. So I use my python console in a linux machine and I just reproduce the code knowing exactly the placement of the lib:

$ python
Python 2.7.5 (default, Apr 2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import sys,imp
imp.load_dynamic(“dimc”,"/var/lib/ignition/user-lib/pylib/dimc.so")
<module ‘dimc’ from ‘/var/lib/ignition/user-lib/pylib/dimc.so’>

I try the same from the script console in the designer:
Input Error: No module named dimc

What should I do to make this workable?.

Thanks in advance,
Patricia

That is a C library. Java (and therefore jython) cannot load those. Java can only load .so or .dll files that follow the JNI standard and cooperate with a matching java .jar file.

Your solution was already stated in your PYTHONPATH topic by @Sanderd17 :

Jython runs in java, so you need to use DIM’s java library, not its python library. Nothing you do with python or library search paths will enable dimc.so to load in java.

thanks, I stop it here. Thanks