diff --git a/swig/edata.i b/swig/edata.i index b2becd6f8d..d3d19b76c8 100644 --- a/swig/edata.i +++ b/swig/edata.i @@ -83,16 +83,18 @@ def __new__(cls, *args, **kwargs): if not args: return super().__new__(cls) - if isinstance(args[0], numpy.ReturnDataView): + from amici.numpy import ReturnDataView + + if isinstance(args[0], ReturnDataView): return super().__new__(cls, _get_ptr(args[0]["ptr"]), *args[1:]) - if isinstance(args[0], (amici_swig.ExpData, amici_swig.ExpDataPtr)): + if isinstance(args[0], (ExpData, ExpDataPtr)): # the *args[:1] should be empty, but by the time you read this, # the constructor signature may have changed, and you are glad this # wrapper did not break. return super().__new__(cls, _get_ptr(args[0]), *args[1:]) - if isinstance(args[0], (amici_swig.Model, amici_swig.ModelPtr)): + if isinstance(args[0], (Model, ModelPtr)): return super().__new__(cls, _get_ptr(args[0])) return super().__new__(cls, *args)