İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
8222 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
En İyi Yanıt

You have to import hello()

from computation import hello

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ağu 25
2569
1
Tem 25
975
1
Ağu 25
1151
0
May 25
1415
2
Nis 25
3602