DeclarePackage["context`",{"name1","name2",…}]
declares that Needs["context`"] should automatically be executed if a symbol with any of the specified names is ever used.


DeclarePackage
DeclarePackage["context`",{"name1","name2",…}]
declares that Needs["context`"] should automatically be executed if a symbol with any of the specified names is ever used.
Details

- You can use DeclarePackage to tell the Wolfram Language automatically to load a particular package when any of the symbols defined in it are used.
- DeclarePackage creates symbols with the attribute Stub in the specified context.
- DeclarePackage prepends context` to $ContextPath.
Examples
open all close allBasic Examples (1)
See Also
Tech Notes
Related Guides
History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), DeclarePackage, Wolfram Language function, https://reference.wolfram.com/language/ref/DeclarePackage.html.
CMS
Wolfram Language. 1991. "DeclarePackage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeclarePackage.html.
APA
Wolfram Language. (1991). DeclarePackage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeclarePackage.html
BibTeX
@misc{reference.wolfram_2025_declarepackage, author="Wolfram Research", title="{DeclarePackage}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/DeclarePackage.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_declarepackage, organization={Wolfram Research}, title={DeclarePackage}, year={1991}, url={https://reference.wolfram.com/language/ref/DeclarePackage.html}, note=[Accessed: 15-August-2025]}