Home > bitburner > NS > dynamicImport
Dynamically import a script. Only scripts located on the same server can be imported. A dynamic import will not adjust RAM usage. This must be done manually with ramOverride.
Signature:
dynamicImport(path: string): Promise<any>;|
Parameter |
Type |
Description |
|---|---|---|
|
path |
string |
Returns:
Promise<any>
RAM cost: 0 GB
File: script.js
export async function main(ns){
const script = await ns.dynamicImport("./scriptToImport.js");
script.log(ns, "Message from an imported script!")
}File: scriptToImport.js
export async function log(ns, message){
ns.tprint(message);
}