Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
7972 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

You have to import hello()

from computation import hello

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvn 25
647
0
kvě 25
804
2
dub 25
2793
1
úno 25
1076
2
úno 25
1742