"""Docstring text for public module.""" from mymodule import my_func from MyMainPackage import some_main_script from MyMainPackage.MySubPackage import mysubscript my_func() some_main_script.report_main() mysubscript.sub_report()
import mymodule mymodule.my_func()
from mymodule import my_func #representation of importing module to your program from MyMainPackage import some_main_script from MyMainPackage.MySubPackage import mysubscript my_func() #print the message stated in mymodule.py on running myprogram.py some_main_script.report_main() mysubscript.sub_report()
from MyMainPackage.some_main_script import report_main from MyMainPackage.SubPackage import mysubscript from mymodule import my_func my_func( ) # Since it's imported directly the function --> It's not necessary to indicate the sumbmodule or package report_main( ) # Since it's imported directly the function --> It's not necessary to indicate the sumbmodule or package mysubscript.sub_report( ) # Since it's not imported directly the function --> It's necessary to indicate the sumbmodule or package
#use my first module import mymodule mymodule.my_func() print mymodule.the_version
#This acts as the main program to be run from mymodule import my_func #this module is in the program directory, but not in a package from MyMainPackage import some_main_script #from the main package from MyMainPackage.SubPackage import mysubscript #from the subpackage my_func( ) #my_func() can be called directly because the module itself was imported some_main_script.report_main( ) #need to have package.func() bc only the package was imported mysubscript.sub_report()
from mymodule import my_func print(my_func())
def main(): my_func() some_main_script.report_main() mysubscript.sub_report()