Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » packages » loadPackage
next | previous | forward | backward | up | index | toc

loadPackage -- load a package

Description

The file PackageName.m2 should be on the load path and should contain a package named PackageName.

If the variable notify is set to true, then an informational message is displayed after the file is loaded.

i1 : notify = true

o1 = true
i2 : loadPackage "FirstPackage"
 -- loading FirstPackage.m2
 -- opening database ${prefix}/lib/x86_64-linux-gnu/Macaulay2/FirstPackage/cache/rawdocumentation-dcba-8.db
 -- beginDocumentation: using documentation database, skipping the rest of ${prefix}/share/Macaulay2/FirstPackage.m2
 -- package "FirstPackage" loaded
 -- loaded ${prefix}/share/Macaulay2/FirstPackage.m2

o2 = FirstPackage

o2 : Package

If the input is a loaded package, then this command will reload the package instead:

i3 : loadPackage FirstPackage
 -- closing database ${prefix}/lib/x86_64-linux-gnu/Macaulay2/FirstPackage/cache/rawdocumentation-dcba-8.db
 -- loading FirstPackage.m2
 -- opening database ${prefix}/lib/x86_64-linux-gnu/Macaulay2/FirstPackage/cache/rawdocumentation-dcba-8.db
 -- beginDocumentation: using documentation database, skipping the rest of ${prefix}/share/Macaulay2/FirstPackage.m2
 -- package "FirstPackage" loaded
 -- loaded ${prefix}/share/Macaulay2/FirstPackage.m2

o3 = FirstPackage

o3 : Package

In fact this version of the command is simply a convenient shortcut for loadPackage with the option Reload overridden to true.

See also

Ways to use loadPackage:

  • loadPackage(Package)
  • loadPackage(String)

For the programmer

The object loadPackage is a method function with options.


The source of this document is in Macaulay2Doc/functions/package-doc.m2:688:0.