Calling a custom function in Rasa Actions

I am facing a problem in developing a chatbot using rasa .

I am trying to call a custom function in rasa action file. But i am getting an error saying “name ‘areThereAnyErrors’ is not defined”

here is my action class. I want to call areThereAnyErrors function from run method. Could someone please help how to resolve this?

class ActionDayStatus(Action):

def areThereAnyErrors(procid):
    errormessagecursor = connection.cursor()
    errormessagecursor.execute(u"select  count(*) from MT_PROSS_MEAGE where pro_id = :procid and msg_T =    :messageT",{"procid": procid, "messageT": 'E'})
    counts = errormessagecursor.fetchone()
    errorCount = counts[0]
    print("error count is {}".format(errorCount))
    if errorCount == 0:
        return False
        return True

def name(self):
    return 'action_day_status'

def run(self, dispatcher, tracker, domain):
    import cx_Oracle
    import datetime
        # Connect as user "hr" with password "welcome" to the "oraclepdb" service running on this computer.
    conn_str = dbconnection
    connection = cx_Oracle.connect(conn_str)
    cursor = connection.cursor()
    dateIndicator = tracker.get_slot('requiredDate')
    delta = datetime.timedelta(days = 1)
    now =
    currentDate = (now - delta).strftime('%Y-%m-%d')
    cursor = connection.cursor()

    cursor.execute(u"select  * from M_POCESS_FILE where CREATE_DATE >= TO_DATE(:createDate,'YYYY/MM/DD') fetch first 50 rows only",{"createDate":currentDate})

    all_files = cursor.fetchall()
    total_number_of_files = len(all_files)

    print("total_number_of_files are {}".format(total_number_of_files)) Decide whether you want a static method or class method or instance method and call it appropriately . Also when you are using connection within the function it should be a member variable or passed to the method You dont have self as aparameter so you may be intending it as a static method - but you dont have it created as such

@Juste, in we are only defining the function within the class but from where these funcation have been called?

Hi @reena_kandari. When you start the action server your custom actions are registered and ready to be executed once predicted. Once the policy predicts the custom action, it sends a request to a custom action server which runs the custom action code.