https://stackoverflow.com/questions/41276067/importing-class-from-another-file
https://stackoverflow.com/questions/20309456/how-do-i-call-a-function-from-another-py-file
from folder.file import Klasa
Or, with from folder import file:
from folder import file
k = file.Klasa()
Or again:
import folder.file as myModule
k = myModule.Klasa()
)if you are importing the entire module, you reiterate the module name when calling it:
import module
module.function_name()
or
import pizza
pizza.pizza_function()
2)or if you are importing specific functions, functions with an alias, or all functions using *, you don't reiterate the module name:
from pizza import pizza_function
pizza_function()
or
from pizza import pizza_function as pf
pf()
or
from pizza import *
pizza_function()
No comments:
Post a Comment