next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > packages > needsPackage(String)

needsPackage(String) -- load a package if not already loaded

Synopsis

Description

For example, to load the sample package FirstPackage:

i1 : notify = true

o1 = true
i2 : needsPackage "FirstPackage"
--database not present: /home2/dan/src/M2/M2/BUILD/dan/builds.tmp/ubuntu1810-release-1.13/usr-dist/x86_64-Linux-Ubuntu-18.10/lib/Macaulay2/FirstPackage/cache/rawdocumentation-dcba-8.db
--beginDocumentation: reading the rest of /home2/dan/src/M2/M2/Macaulay2/packages/FirstPackage.m2
--package "FirstPackage" loaded
--loaded /home2/dan/src/M2/M2/Macaulay2/packages/FirstPackage.m2

o2 = FirstPackage

o2 : Package
i3 : needsPackage "FirstPackage"

o3 = FirstPackage

o3 : Package
The second time the package was not reloaded.

See also