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
8003 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ść
0
lip 25
99
1
cze 25
806
0
maj 25
917
2
kwi 25
2918
1
lut 25
1201