콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8117 화면

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
7월 25
496
1
6월 25
1078
0
5월 25
1204
2
4월 25
3196
1
2월 25
1429