How I supose to use other files? It doesn´t allows me to do it.
When I try to use a comand that I created in another file in the main file it doesn´t work.
Do I need to activate something??
Or use a caracteristic comand?
I use phyton
just import the file
then you can use functions inside of that file by calling the file name, and then the function name. So if I made a file called
hello_world.py and put
def hello(): print("Hello World!")
inside of it, then in my
main.py I could do
import hello_world hello_world.hello() # "Hello World!" is printed to the console
or I could do this
from hello_world import hello hello() # "Hello World!" Is printed to the console
Or you can do import os than for example you have a file named Test.py do so.system(‘python Test.py’)