module File that describes the processing of python script
import module_name
# module_name.some_func()Call with
from module_name import some_func
# some_func()Call with
You can check the path when searching for a module below
import sys
print(sys.path)
The beginning of path is the path of the executable file.
If you want to add it, use sys.path.append ("./ some_path ")
etc.
package
A collection of modules. __Init__.py
is required in the directory that contains the modules.
import package_name.module_name
# module_name.some_func()Call with
import package_name.subpackage_name
# subpackage_name.some_func()Call with
from package import module
# module.some_func()Call with
Recommended Posts