Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
7984 Tampilan

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?

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai

You have to import hello()

from computation import hello

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Jun 25
668
0
Mei 25
821
2
Apr 25
2816
1
Feb 25
1098
2
Feb 25
1761