コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
7941 ビュー

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
359
0
5月 25
510
2
4月 25
2585
1
2月 25
922
2
2月 25
1419