Scope of sys.setdlopenflags?

I tried using

import sys,ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)

then calling into a function provided by a loaded .so which sports a python interface but is
an embedded ocaml runtime which in its turn loads further .so files for its own use.
so the above lines I put into a __init__.py and they did not prevent missing symbols errors ocurring during the .so loads.
but when I feed these lines to an ipython interpreter then make my FFI call, things work fine.
can anyone say what the difference is?

Note the docs do not show ctype being used, maybe you need to use os for correct operation sys — System-specific parameters and functions — Python 3.13.2 documentation

thanks but it didn’t make any difference - works in one scenario and not the other.