Python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)] on win32 Enter "help" below or click "Help" above for more information. import os,sys,importlib #Импорт трёх важных вспомогательных модулей os.chdir('C:\\Users\\User-PC\\python-labs\\TEMA8') #Делаем рабочий каталог текущим os.getcwd() #Контролируем корректность установки текущего каталога 'C:\\Users\\User-PC\\python-labs\\TEMA8' import Mod1 Mod1:Введите значение = 5 Mod1:Значение perm1= 5 type(Mod1) dir(Mod1) ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'perm1'] Mod1.perm1 '5' imp.reload(Mod1) Traceback (most recent call last): File "", line 1, in imp.reload(Mod1) NameError: name 'imp' is not defined import Mod1 imp.reload(Mod1) Traceback (most recent call last): File "", line 1, in imp.reload(Mod1) NameError: name 'imp' is not defined importlib.reload(Mod1) Mod1:Введите значение = 3 Mod1:Значение perm1= 3 Mod1.perm1 '3' print(sorted(sys.modules.keys())) ['Mod1', '__future__', '__main__', '_abc', '_ast', '_bisect', '_bz2', '_codecs', '_collections', '_collections_abc', '_colorize', '_compat_pickle', '_compression', '_datetime', '_frozen_importlib', '_frozen_importlib_external', '_functools', '_heapq', '_imp', '_io', '_lzma', '_opcode', '_opcode_metadata', '_operator', '_pickle', '_pyrepl', '_pyrepl.pager', '_queue', '_random', '_signal', '_sitebuiltins', '_socket', '_sre', '_stat', '_string', '_struct', '_suggestions', '_sysconfig', '_thread', '_tkinter', '_tokenize', '_typing', '_warnings', '_weakref', '_weakrefset', '_winapi', '_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf_8', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete_w', 'idlelib.calltip', 'idlelib.calltip_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger_r', 'idlelib.debugobj', 'idlelib.debugobj_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib._abc', 'importlib._bootstrap', 'importlib._bootstrap_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're._casefix', 're._compiler', 're._constants', 're._parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib'] sys.modules.pop('Mod1') print(sorted(sys.modules.keys())) ['__future__', '__main__', '_abc', '_ast', '_bisect', '_bz2', '_codecs', '_collections', '_collections_abc', '_colorize', '_compat_pickle', '_compression', '_datetime', '_frozen_importlib', '_frozen_importlib_external', '_functools', '_heapq', '_imp', '_io', '_lzma', '_opcode', '_opcode_metadata', '_operator', '_pickle', '_pyrepl', '_pyrepl.pager', '_queue', '_random', '_signal', '_sitebuiltins', '_socket', '_sre', '_stat', '_string', '_struct', '_suggestions', '_sysconfig', '_thread', '_tkinter', '_tokenize', '_typing', '_warnings', '_weakref', '_weakrefset', '_winapi', '_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf_8', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete_w', 'idlelib.calltip', 'idlelib.calltip_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger_r', 'idlelib.debugobj', 'idlelib.debugobj_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib._abc', 'importlib._bootstrap', 'importlib._bootstrap_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're._casefix', 're._compiler', 're._constants', 're._parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib'] import Mod1 Mod1:Введите значение = 9 Mod1:Значение perm1= 9 sys.modules.pop('Mod1') exec(open('Mod1.py').read()) Mod1:Введите значение = 8 Mod1:Значение perm1= 8 exec(open('Mod1.py', encoding='utf-8').read()) Mod1:Введите значение = 4 Mod1:Значение perm1= 4 from Mod1 import perm1 Mod1:Введите значение = 5 Mod1:Значение perm1= 5 dir() ['Mod1', '__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '__warningregistry__', 'importlib', 'os', 'perm1', 'sys'] perm1 '5' from Mod2 import beta g=beta(2) ****BETA**** g 535.4916555247646 dir() ['Mod1', '__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '__warningregistry__', 'beta', 'g', 'importlib', 'os', 'perm1', 'sys'] alpha() Traceback (most recent call last): File "", line 1, in alpha() NameError: name 'alpha' is not defined al() Traceback (most recent call last): File "", line 1, in al() NameError: name 'al' is not defined. Did you mean: 'all'? from Mod2 import alpha as al #Функция alpha была импортирована из модуля, ей был присвоен псевдоним al al() ****ALPHA**** Значение t=4 '4' del al,beta from Mod2 import alpha as al, beta as bt del al del bt from Mod2 import * #Звездочка означает, что импортируется весь модуль, а не конкретные функции. tt=alpha() ****ALPHA**** Значение t=0.12 uu=beta(float(tt)) ****BETA**** >>> uu 1.4578913609506803 >>> sys.modules.pop('Mod1') >>> sys.modules.pop('Mod2') >>> import Mod0 Mod1:Введите значение = 5 Mod1:Значение perm1= 5 perm1= 5 ****ALPHA**** Значение t=8 tt= 8 ****BETA**** qq= 82226315585.59491 >>> Mod0.tt;Mod0.qq;Mod0.Mod1.perm1 '8' 82226315585.59491 '5' >>> import MM2 k1,T,k2,Xm,A,F,N=0.5,35,0.6,5,1000,5,15 >>> print('y=',MM2.vyhod) y= [0, 8.209118281877132, 29.104924685415277, 40.86232427117668, 38.3075414151359, 34.68635884409398, 42.90679739719954, 57.19526562043458, 60.53754513466764, 47.64611630565597, 31.742316122264157, 25.812753880749888, 24.278160244795345, 10.44509996519298, -10.518946273258612]