Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
8045 Vizualizări

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?

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

You have to import hello()

from computation import hello

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
iul. 25
246
1
iun. 25
952
0
mai 25
1024
2
apr. 25
3036
1
feb. 25
1301