I learned to import modules, but I do not know how to, for example, create a class in a separate file and include it in the main program, how to do that?
I learned to import modules, but I do not know how to, for example, create a class in a separate file and include it in the main program, how to do that?
Save the file in the same folder as the original file and you can import it without any problems.
file1.py
class Classe:
def __init__():
....
file2.py
from arquivo1 import Classe
obj = Classe()
......