Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
8042 Weergaven

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?

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Beste antwoord

You have to import hello()

from computation import hello

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
jul. 25
238
1
jun. 25
944
0
mei 25
1000
2
apr. 25
3024
1
feb. 25
1297