[Tutor] do i have to import modules at the start of a file?
Kent Johnson
kent37 at tds.net
Wed Sep 26 23:52:35 CEST 2007
shawn bright wrote:
> lo there all,
>
> i have a gui program that imports a few modules that i don't need if i
> am using the program remotely.
> The program has an admin interface and thread interface, only the admin
> interface is needed when
> i am using the program from a remote computer.
>
> all of my modules are imported at the start of the file, and not
> initiated till a certain button is clicked on the GUI, could i put those
> import statements in the button click event?
Yes but why do you want to? The reasons I know for doing this:
- the import takes a long time or a lot of memory and you don't want to
incur the cost unless you need it
- the imported module may not be available always and you want the rest
of the importing module still to be usable
Kent
More information about the Tutor
mailing list