跳至內容
選單
此問題已被標幟
2 回覆
7997 瀏覽次數

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?

頭像
捨棄
最佳答案

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

頭像
捨棄
最佳答案

You have to import hello()

from computation import hello

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
6月 25
770
0
5月 25
900
2
4月 25
2895
1
2月 25
1181
2
2月 25
1835