Skip to Content
Menu
This question has been flagged
2 Replies
8084 Rodiniai

e.g.


computation.py

------------------------

class A(object):

def hell(self, number)

{

----

}



b = A()




-----------------------------


sale module

sale.py


class sale_order(models.Model):

def abc(self):

# Here i wants to use that method hello() How can i use it?

Portretas
Atmesti
Best Answer

Hi Irfankhan,

You can put computation.py file in the same folder in which sale.py file is placed and You can do following code in the sale.py.

from . import computation

and you can make object of class A in the following way:

b = computation.A()

and you can call method as follow:

b.hell(13)

Regards,

Hardik

Portretas
Atmesti
Best Answer

You have to import hello()

from computation import hello

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
liep. 25
418
1
birž. 25
1044
0
geg. 25
1163
2
bal. 25
3153
1
vas. 25
1366