How to use another file in Python ?
Hi guys !
for a project in Python i need to use many files, but if a function is in the file "english.py", how can i call this function in "index.py" ?
print("Thanks if you give an answer !")
Voters
[deleted]
execfile("Your File.py")
PancakeDev
@Harkinian Yes but i need to import a library or not ?
[deleted]
@DevsOfAnGus
No but
execfile() only works at py2 by the way if you using py3 use this
No but
execfile() only works at py2 by the way if you using py3 use this
exec(open('your file.py').read())
At the head of index.py do
from english import *
. Then call the function.