Accessing real and imaginary part in cupy complex ndarray under a rawkernel function

Hello everyone,
It’s the first time I use this group.
I’m a french engeneer in a university laboratory.
I’ve already developped a soft for analysing hologram in C++/CUDA.
For researcher and student I’m developping a new code in Python/CUPY

I’ve already quite translating all the functions needed but I have some problem when I want to access imaginary and real part of some complex cupy array in a rawkernel.
Here is my functions and the related error:

@jit.rawkernel()
def clean_plan_cplx_device(d_plan_cplx, size_x, size_y, posX, posY, clean_radius_pix):
    index = jit.blockIdx.x * jit.blockDim.x + jit.threadIdx.x
    sizeXY = size_x * size_y
    jj = cp.int32(index) // cp.int32(size_x)
    ii = cp.int32(index) - cp.int32(jj * size_x)

    if (ii < size_x and jj < size_y): 
        distance = cp.sqrt((posX - ii)**2 + (posY - jj)**2)
        cplx = d_plan_cplx[ii, jj]
        r = cp.real(cplx)
        i = cp.imag(cplx)
        mod = cp.sqrt(r**2 + i**2)

    if (distance < clean_radius_pix):
        d_plan_cplx[ii, jj] = 0.0+0j
    else:
        d_plan_cplx[ii, jj] = mod + 0j

def clean_plan_cplx(d_plan_cplx, size_x, size_y, posX, posY, clean_radius_pix,):
    nthread = 1024
    nBlock = size_x * size_y // nthread +1
    clean_plan_cplx_device[nBlock, nthread](d_plan_cplx, size_x, size_y, posX, posY, clean_radius_pix)

TypeError: Invalid function call ‘real’.

However, I can access it outside the rawkernel by this way ( eg. cp.real(d_plan_cplx[0,0])

Is there a way to acces real and imaginary part in this kernel?

Thank you for your help
Best regards

Simon

Has anyone ever tryed to access iamg and real part of complex in rawkernel?