# Script throws variable not in scope

**URL:** <https://forum.canton.network/t/script-throws-variable-not-in-scope/1854>\
**Category:** App Development\
**Tags:** daml-sdk\
**Created:** [December 26, 2020, 12:12pm UTC](https://forum.canton.network/t/script-throws-variable-not-in-scope/1854 "2020-12-26T12:12:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suchindra](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@suchindra](https://forum.canton.network/u/suchindra)\
**Post date:** [December 26, 2020, 12:12pm UTC](https://forum.canton.network/t/script-throws-variable-not-in-scope/1854/1 "2020-12-26T12:12:48Z")

</div>

I am learning DAML. While following the tutorial at the following location, I am shown an error saying :

```haskell
/home/suchivaish/src/Office/DAML/Token.daml:22:16: error: 
Variable not in scope: script : Scenario (ContractId Token) -> ttypecheck

```

Tutorial link: [https://docs.daml.com/daml/intro/2\_DamlScript.html](https://docs.daml.com/daml/intro/2_DamlScript.html)

My Token.daml file:

```haskell
module Token where

template Token
    with
        owner : Party
  
    where
        signatory owner

-- The below code works:
-- token_test_1 = do
-- alice <- getParty "Alice"
-- submit alice do
-- create Token with owner = alice

token_test_2 = script do
    bob <- getParty "Bob"
    submit bob do
        create Token with owner = bob

```

Request you to please help me with what is wrong with the above code

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [December 26, 2020, 1:28pm UTC](https://forum.canton.network/t/script-throws-variable-not-in-scope/1854/2 "2020-12-26T13:28:15Z")

</div>

Hi @suchindra,

The `script` function is not part of the core DAML language; it is part of a separate module in the standard library. To get access to it, you have to explicitly important that module. The easiest way to do that is to add this line:

```haskell
import Daml.Script 

```

right after the `module ... where` line, near the top of the file.

---

<div class="post-metadata">

**Author:** ![suchindra](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@suchindra](https://forum.canton.network/u/suchindra)\
**Post date:** [December 26, 2020, 2:17pm UTC](https://forum.canton.network/t/script-throws-variable-not-in-scope/1854/3 "2020-12-26T14:17:26Z")

</div>

Thanks @Gary_Verhaegen 🙂

Including the import statement enabled the script module to be downloaded. The only additional thing I had to do was

- Create a daml.yaml file with the following:

> ```
> sdk-version: 1.6.1
> name: szabo_car_contract
> version: 1.0.0
> source: daml/Token.daml
> scenario: Token
> parties:
> - Alice
> - Bob
> exposed-modules:
> - Main
> dependencies:
> - daml-prim
> - daml-stdlib
> - daml-script
> 
> ```

- And restart the visual studio
