python import own module code example
Example 1: how to import your own function python
#For one particular fuction,
from fileName import function1()
fileName.function1()
#For multiple functions,
from fileName import function1(), function2()
fileName.function1()
fileName.function2()
#For all functions (or to remove the "fileName." prfix),
from fileName import *
function1()
function2()
function3()
#(You don't need to call all of them, I'm just demonstrating)
Example 2: How import a module in python
import mymodule #Ex : tkinter, turtle, etc...
#If you want import a module who isn't in Python (PyGame, QWidgets)
#and you have PyCharm, write : "pip install mymodule", wait the installation
#and write in interpreter : import mymodule, for other ide, search on
#forums
Example 3: create a python file and import it as library in other file
# Script file: my_script.py
import my_module
my_module.hello_printer()
print("Creator:", my_module.name)