示例#1
0
"""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()
示例#2
0
import mymodule

mymodule.my_func()
示例#3
0
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()
示例#4
0
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
示例#5
0
#use my first module

import mymodule 

mymodule.my_func()

print mymodule.the_version
示例#6
0
#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()
示例#7
0
from mymodule import my_func

print(my_func())
示例#8
0
def main():
    my_func()
    some_main_script.report_main()
    mysubscript.sub_report()