Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
8199 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

You have to import hello()

from computation import hello

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 25
2423
1
lip 25
917
1
sie 25
1151
0
maj 25
1347
2
kwi 25
3569