** Summary ** How to use and manage Tcl packages. ** See Also ** [Tcl User Guide%|%User Guide%|%] [Tcl Package Developer Guide%|%Package Developer Guide%|%] ** Finding the Location of a Package ** [Don Porter] offers ====== namespace eval ::myIcons { # ... variable home [file join [pwd] [file dirname [info script]]] # ... } # ... proc ::myIcons::getPath {} { variable home return $home } ====== [DGP]: Hmmmm... since someone bothered to record that advice for Wiki posterity, I should add that this is nothing more than an updated version of the advice found in library(n) and tclvars(n) that each package should define a global variable ''${package}_library'' analogous to ''tcl_library'' and ''tk_library'' storing the directory in which that package is installed. That original advice came before [namespace], back in the bad old days when the only persistent variables that could be defined were global variables. (````Persistent'' in the sense that they live longer than the execution of one [proc].) Nowadays, we clearly shouldn't be defining global variables when a namespace variable will do. Also, I've moved away from a variable named ''library'' because I find that word is used to just mean way too many different things. It's just too confusing. ** Description ** In the most elementary case, using a package is a matter of directly employing the [load] or [source] command to make the code in some file available to Tcl. This can be seen in the following examples: [extension example] Typically, however, packages are distributed such that they can be loaded via the [package] command. [Just getting a package found already]: [Where does the package command find the packages it seeks?]: [How to unload a package]: [Package tips and tricks]: <>