Accessing member function using terminal


I would like to know is there any way to execute any function inside class just like this

bench execute erpnext.erpnext.accounts.doctype.payment_request.payment_request.send_mail

i am getting the output for above code but i want to execute a function inside the class i want this because i want to access value like…

consider an example

i have an class to

class SendMail(Document):
def send_mail(self):
how can i get access the function send_mail using

bench execute erpnext.erpnext.accounts.doctype.SendMailt.SendMail.send_mail

please help me thanks

for sending mail you can use the following function anywhere in the class.


		subject='Testing Mail',
		message='''Hello, This is test mail'''

@Sangram okey

but i would like to get the value inside the class with out execute to entire process for example i want to check a function inside the payment request class each time i have make purchase an then make sales order an then payment which more time taking so i want to know is there any way to access only the function inside a class

i used bench execute in similar case but that function was not inside a class but when i use bench execute for a function inside the class i am getting the error in terminal

AttributeError: ‘module’ object has no attribute ‘send_mail’

but there is function inside class and if write another function on same file outside class i get an expected result but i need to use function inside class because i want to get current doctype name which is in variable and i cant access self function outside class

i hope i am clear

thanks for the replay


It will not execute the send_mail method as it will need the instance of SendMail class, to execute the method you will need to create an object of SendMail class then call the send_mail method

1 Like