I am making rasa-nlu+core bot using python. When I am running train_init.py file(for making rasa core model) providing Actions for purchasing something it shows Exception: Can not access action ‘action_purchase’, as that name is not a registered action for this domain. Available actions are: My action file name is action_purchase.py class made in this file is action_purchase action name provide is domain.yml file is action_purchase.action_purchase and in the stories.md file is action_purchase. What is wrong in this method?

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import requests

from rasa_core.actions import Action

class action_purchase(Action):
player_purchase_token = ""

def name(self):
	return 'action_purchase'

def login(self):
	url = url
	headers = {'Content-Type': ' ', 'username: ' ','password': ' '}
	_login = json file
	response = requests.post(url, json = _login, headers= headers).json()
	player_purchase_token = response["playerToken"]
	return player_purchase_token

def purchase_ticket(self, dispatcher, player_purchase_token, domain):
	url = "url"
	headers = {'Content-Type': '','username': '','password': ''}
	purchase_payload = json file2
	raw_resp = requests.post(url, json = purchase_payload, headers= headers)
	ticket = raw_resp.json()

	AvailableBal = ticket["availableBal"]
    Number = ticket["Data"]["Number"]
	response = """Your available balance is {} and your number is {}.""".format(AvailableBal, Number)
	return []

I am using rasa-core 0.10.4 and rasa-nlu 0.13.2

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

You need a run() method, rather than your login/purchase_ticket methods. And what does your domain file look like?


python actions.py Traceback (most recent call last): File “actions.py”, line 8, in from rasa_core.actions.forms import ( ModuleNotFoundError: No module named ‘rasa_core.actions.forms’

will someone solve this problem