How to access Javascript module with Duktape in Android : <p>I am successfully parsing and evaluating a javascript file with Duktape in my Android application using Kotlin.</p>

<pre><code>val file_name = "lib.js"

val js_string = application.assets.open(file_name).bufferedReader().use {
  it.readText()
}


val duktape = Duktape.create()

try {
  Log.d("Greeting", duktape.evaluate("'hello world'.toUpperCase();").toString())
  duktape.evaluate(js_string)

} finally {
  duktape.close()
}
</code></pre>

<p>The javascript file was created with Browserify, so it is one single file with everything and it is working fine. But I need to request a module and a method from the module, example:</p>

<pre><code>var test = require('testjs-lib');
test.EVPair.makeRandom().toWTF();
</code></pre>

<p>I have no idea of how to do it and have not found any example, besides this link: <a href="http://wiki.duktape.org/HowtoModules.html" rel="noreferrer">http://wiki.duktape.org/HowtoModules.html</a></p>

<p>It tells me to use a modsearch, but I don't have a clue how to do it or where it should be placed, not even if it is applicable for the Duktape Android (<a href="https://github.com/square/duktape-android" rel="noreferrer">https://github.com/square/duktape-android</a>).</p>

<p>Has anybody done it successfully that could shed some light on this matter?</p>
