Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
8049 Переглядів

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 Відповіді Переглядів Дія
0
лип. 25
263
1
черв. 25
961
0
трав. 25
1045
2
квіт. 25
3050
1
лют. 25
1307