Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
8011 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Melhor resposta

You have to import hello()

from computation import hello

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
jul. 25
148
1
jun. 25
831
0
mai. 25
929
2
abr. 25
2936
1
fev. 25
1235