I am trying to make function to control the ARTIQ, but it is not working. Any advice? Thanks!

from artiq.experiment import *
import numpy as np

class fun:
    def sine(core,dd0):
        core.reset()        
        delay(10*ms)
        dd0.init()
        dd0.sw.on()

class RFmix(EnvExperiment):
    def build(self):
        self.setattr_device("core")
        self.setattr_device("urukul0_ch0")
        self.dd0 = self.urukul0_ch0


    @kernel
    def run(self):
        fun.sine(self.core,self.dd0)

I solve the problem by adding @kernel

    @kernel
    def sine(core,dd0):
        core.reset() 
        delay(10*ms)
        dd0.init()
        dd0.sw.on()