Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
8073 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Meilleure réponse

You have to import hello()

from computation import hello

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
juil. 25
378
1
juin 25
1019
0
mai 25
1133
2
avr. 25
3136
1
févr. 25
1345