Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
8187 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
авг. 25
2395
1
июл. 25
899
1
авг. 25
1151
0
мая 25
1340
2
апр. 25
3555