# How to activate a package in a script?

**URL:** <https://discourse.julialang.org/t/how-to-activate-a-package-in-a-script/28185>\
**Category:** General Usage\
**Tags:** pkg\
**Created:** [August 29, 2019, 10:29pm UTC](https://discourse.julialang.org/t/how-to-activate-a-package-in-a-script/28185 "2019-08-29T22:29:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [August 30, 2019, 3:15am UTC](https://discourse.julialang.org/t/how-to-activate-a-package-in-a-script/28185/2 "2019-08-30T03:15:43Z")

</div>

You can just make a regular old temporary directory to put your environment in. One of `Pkg`’s many strengths is that it separates the set of installed packages from the active environment. This means creating new environments is virtually free!

You can think of `Pkg.add` as “make sure these packages are available”. If they are already installed somewhere else, `Pkg` will know and you don’t have to reinstall them.

```julia
#!/usr/bin/env julia
import Pkg

tempdir = mktempdir()
Pkg.activate(tempdir)
Pkg.add(["ArgParse", "Pope"])

using ArgParse, Pope
Pope.dostuff()

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-activate-a-package-in-a-script/28185)._
