Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
8201 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

You have to import hello()

from computation import hello

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
2429
1
lug 25
919
1
ago 25
1151
0
mag 25
1360
2
apr 25
3573