No Daml.Script import?

I’m following along with the DAML Script docs but getting an error on import Daml.Script

Could not find module ‘Daml.Script’
It is not a module in the current program, or in any known package.

My daml.yaml looks like this:

sdk-version: 0.13.55
name: szabo_car_contract
version: 1.0.0
source: daml/Main.daml
scenario: Main:mainScenario
parties:
- Alice
- Bob
exposed-modules:
- Main
dependencies:
- daml-prim
- daml-stdlib
- daml-script
1 Like

Restarting DAML Studio (ie. exit Visual Studio Code, run daml studio again) fixed the import issue.

1 Like

The other possible cause is that DAML Studio (/VS Code) has to be opened on the directory containing the daml.yaml file. For example, you have a foo/bar/daml.yaml project root, and open VS Code in foo, it will fail to resolve the DAML Script library. This is a known issue: #5455

6 Likes

As @bernhard states, you need to open the Project directory containing the daml.yaml else VS Code outputs an error. Following his advice, error gone :+1:t2:

Could you clarify what exactly the issue is? Maybe provide reproducing steps?

daml new t
cd t
daml studio

yields a working import Daml.Script for me.

Ensure that when creating the new DAML project that you cd into it before “Daml studio”

3 Likes