humix
How to Import a Python Function from Another File
239K views · Apr 5, 2022
Learn how to import a Python function from a different file than the one where your main application is coded.

This is a standard practice that allows to define common functions in a single file or module that can then be used by multiple Python programs using the import statement.

We will also see the difference between "import {module}" and "from {module} import {function}".

And finally we will use the Python sys module to add the absolute path where our functions file is located to the Python path.

Enjoy this tutorial!
Claudio

#PythonProgramming #PythonTutorial #PythonForBeginners
see more

Comments

Latest Videos
place
12:35
play
What You Should Know About __name__ and __main__ in Python
What You Should Know About __n...
What You Should Know About __name__ and __main__ in Python
2K views