CustomFormFactor not compatible with scipy

BornAgain Version 22 on Windows 11

I’m attempting to implement a custom form factor similar to the example provided:

The custom form factor function that I am trying to implement requires the use of SciPy to calculate Bessel functions and perform integrals. When running the code, the output is a 2D detector image with zero intensity (essentially blank). In BornAgain version 21.2, this raised a "SWIG director method error," but after switching to version 22, there is no output at all. From my initial testing, it seems the code executes until a SciPy function (specifically sp.j0(x)) is called, at which point it fails.

The issue can be reproduced by taking the example code and simply adding a single line that calls the Bessel function from the SciPy module. I’ve attached a file with this simple modification. CustomFormFactorExample.py

Edited by oliveirp