modules import graphics vector svg as svg image svg load("snow svg"we can always use our own short name for moduleas we have done herealthough this does increase the risk of having name conflict all the imports we have used so far (and that we will use throughout the rest of the bookare absolute imports--this means that every module we import is in one of sys path' directories (or subdirectories if the import name included one or more periods which effectively serve as path separatorswhen creating large multimodule multidirectory packages it is often useful to import other modules that are part of the same package for examplein eps py or svg py we could get access to the png module using conventional importor using relative importimport graphics png as png from graphics import png these two code snippets are equivalentthey both make the png module directly available inside the module where they are used but note that relative importsthat isimports that use the from module import syntax with leading dots in front of the module name (each dot representing stepping up one directory)can be used only in modules that are inside package using relative imports makes it easier to rename the top-level package and prevents accidentally importing standard modules rather than our own inside packages custom modules |since modules are just py files they can be created without formality in this section we will look at two custom modules the first moduletextutil (in file textutil py)contains just three functionsis_balanced(which returns true if the string it is passed has balanced parentheses of various kindsshorten((shown earlier )and simplify() function that can strip spurious whitespace and other characters from string in the coverage of this module we will also see how to execute the code in docstrings as unit tests the second modulechargrid (in file chargrid py)holds grid of characters and allows us to "drawlinesrectanglesand text onto the grid and to render the grid on the console this module shows some techniques that we have not seen before and is more typical of largermore complex modules the textutil module the structure of this module (and most othersdiffers little from that of program the first line is the shebang lineand then we have some comments (typically the copyright and license informationnext it is common to have