question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include/Import local file dependency

See original GitHub issue

In a project, I have multiple kotlin script files, and I have some methods I need to use in most, if not all script.

Is there an existing way to write these method in a single external file, and include it from the other scripts ?

eg : utils.kts

fun foo(s : String) : String {
  //...
}

myscript.kts

#!/usr/bin/env kscript

//INCLUDE utils.kts

foo(args[0])

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
xgouchetcommented, Aug 29, 2017

That seems perfect for what I want !

1reaction
holgerbrandlcommented, Aug 12, 2017

I’ve implemented it in a separate branch for now. See https://github.com/holgerbrandl/kscript/blob/include_directive/test/resources/includes/include_variations.kts for an example. Feel welcome to let me know what you think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - How to import local dependency from node_modules
I have done npm install ./pathtolocalfolder --save . My package.json has a dependency with name: file: ../pathtolocalfolder .
Read more >
npm install supports local packages and dependencies
The npm install command supports local development and allows to quickly install and symlink local modules and packages.
Read more >
How to import a local module dependency in Elixir
This guide will show you how to take an Elixir package you've made locally and import it into another project using the file...
Read more >
Dependency resolution - Parcel
It is recommended to include the full file extension in all import specifiers. This both improves dependency resolution performance and reduces ambiguity.
Read more >
How to use local Node packages as project dependencies
How to use local Node packages as project dependencies · Install yalc. Install yalc · Publish a package to your local yalc store....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found