Bringing files, classes and methods from another Python file

Asked

Viewed 398 times

0

I need to bring a class file like this that is in class.py:

class Despesas(object):
    def __init__(self):
        self.Prioridade = Prioridade()
        self.Situacao = True
        self.Valor = 0.0
        self.Categoria = ''

To the View.py file.

In PHP I can do this function with the require('Filename') method, How to do this in Python 3.6?

  • Something like from classe import Despesas

  • Too basic a question about language syntax

  • https://wiki.python.org.br/ModulosPacks -I suggest reading, even if above, in the tutorial - has a very nice translation: https://wiki.python.org.br/Tutorial_Python

  • I ruled out the closing vote, but it’s also a duplicate of https://answall.com/questions/231365/import-python

  • Possible duplicate of Import in Python

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.