+ 1
How to import puthon scrip from other file
How I can import py script fr other file
2 odpowiedzi
+ 5
May be this can help you. It's a small tutorial how to import your own modules and access the functions from there:
https://code.sololearn.com/c7yTf6ApPZZN/?ref=app
+ 2
If you have two python files in the same folder, you can do import just like from standard libraries. This is usually how larger projects are split in smaller parts.
Example:
you have main.py that you run
and tools.py where you have a function called trick()
In main.py you can do this:
import tools
tools.trick() # call with prefix
You can also import with an alias, or import specific functions or everything:
from tools import *
trick() # without prefix
Review also the lessons and comments below:
https://www.sololearn.com/learn/Python/2488/