lib/Nexus.js
async function compileInstance(pidapx, inst, saveRoot = false) {
				log.v('compileInstance', pidapx, JSON.stringify(inst, null, 2));
				let Local = {};
				let modnam = (typeof inst.Module == 'object') ? inst.Module.Module : inst.Module;
				let mod;
				let ents = [];
				modnam = modnam.replace(/:\//g, '.');

				if (modnam in ModCache) {
					mod = ModCache[modnam];
				} else {
					log.e('Module <' + modnam + '> not in ModCache');
					process.exit(1);
					return;
				}

				let schema = await new Promise(async (res, rej) => {
					if ('schema.json' in mod.files) {
						mod.file('schema.json').async('string').then(function (schemaString) {
							res(JSON.parse(schemaString));
						});
					} else {
						log.e('Module <' + modnam + '> schema not in ModCache');
						process.exit(1);
						rej();
						return;
					}
				});

				let entkeys = Object.keys(schema);

				//set Pids for each entity in the schema
				for (let j = 0; j < entkeys.length; j++) {
					let entkey = entkeys[j];
					if (entkey === 'Apex') {
						Local[entkey] = pidapx;
					} else {
						Local[entkey] = genPid();
					}
				}

				//unpack the par of each ent
				for (let j = 0; j < entkeys.length; j++) {
					let entkey = entkeys[j];
					//start with the pars from the schema
					let ent = schema[entkey];
					ent.Pid = Local[entkey];
					ent.Module = modnam;
					ent.Apex = pidapx;

					//unpack the inst pars to the par of the apex of the instance
					if (entkey == 'Apex' && 'Par' in inst) {
						let pars = Object.keys(inst.Par);
						for (let ipar = 0; ipar < pars.length; ipar++) {
							let par = pars[ipar];
							ent[par] = inst.Par[par];
						}
					}

					//pars all values for symbols
					let pars = Object.keys(ent);
					for (let ipar = 0; ipar < pars.length; ipar++) {
						let par = pars[ipar];
						let val = ent[par];
						if (entkey == 'Apex' && saveRoot) {
							// if (par == '$Setup') { Setup[ent.Pid] = val; }
							// if (par == '$Start') { Start[ent.Pid] = val; }
						}
						ent[par] = await symbol(val);
					}
					ents.push(ent);
				}

				let entsPromise = [];

				for (let par of ents) {
					entsPromise.push((async function () {
						let impkey = modnam + '/'+ par.Entity;
						if (!(impkey in ImpCache)) {
							let entString = await new Promise(async (res, _rej) => {
								if (!(par.Entity in mod.files)){
									log.e('Entity <'+par.Entity+'> not in Module <' + modnam + '>');
									process.exit(1);
									return;
								}
								mod.file(par.Entity).async('string')
									.then((string) => res(string));
							});
							ImpCache[impkey] = indirectEvalImp(impkey, entString, log,
								createRequireFromModuleType(modnam));
						}
						EntCache[par.Pid] = new Volatile(new Entity(Nxs, ImpCache[impkey], par, log));
						cacheInterface.EntIndex[par.Pid] = par.Apex;
					})());
				}
				await Promise.all(entsPromise);

				async function symbol(val) {
					if (typeof val === 'object') {
						if (Array.isArray(val)) {
							val.map(v => symbol(v));
							val = await Promise.all(val);
						} else {
							for (let key in val) {
								val[key] = await symbol(val[key]);
							}
						}
						return val;
					}
					if (typeof val !== 'string')
						return val;
					let sym = val.substr(1);
					if (val.charAt(0) === '#' && sym in Local)
						return Local[sym];
					if (val.charAt(0) === '\\')
						return sym;
					return val;
				}
			}
async function compileInstance(pidapx, inst, saveRoot = false) {
				log.v('compileInstance', pidapx, JSON.stringify(inst, null, 2));
				let Local = {};
				let modnam = (typeof inst.Module == 'object') ? inst.Module.Module : inst.Module;
				let mod;
				let ents = [];
				modnam = modnam.replace(/:\//g, '.');

				if (modnam in ModCache) {
					mod = ModCache[modnam];
				} else {
					log.e('Module <' + modnam + '> not in ModCache');
					process.exit(1);
					return;
				}

				let schema = await new Promise(async (res, rej) => {
					if ('schema.json' in mod.files) {
						mod.file('schema.json').async('string').then(function (schemaString) {
							res(JSON.parse(schemaString));
						});
					} else {
						log.e('Module <' + modnam + '> schema not in ModCache');
						process.exit(1);
						rej();
						return;
					}
				});

				let entkeys = Object.keys(schema);

				//set Pids for each entity in the schema
				for (let j = 0; j < entkeys.length; j++) {
					let entkey = entkeys[j];
					if (entkey === 'Apex') {
						Local[entkey] = pidapx;
					} else {
						Local[entkey] = genPid();
					}
				}

				//unpack the par of each ent
				for (let j = 0; j < entkeys.length; j++) {
					let entkey = entkeys[j];
					//start with the pars from the schema
					let ent = schema[entkey];
					ent.Pid = Local[entkey];
					ent.Module = modnam;
					ent.Apex = pidapx;

					//unpack the inst pars to the par of the apex of the instance
					if (entkey == 'Apex' && 'Par' in inst) {
						let pars = Object.keys(inst.Par);
						for (let ipar = 0; ipar < pars.length; ipar++) {
							let par = pars[ipar];
							ent[par] = inst.Par[par];
						}
					}

					//pars all values for symbols
					let pars = Object.keys(ent);
					for (let ipar = 0; ipar < pars.length; ipar++) {
						let par = pars[ipar];
						let val = ent[par];
						if (entkey == 'Apex' && saveRoot) {
							// if (par == '$Setup') { Setup[ent.Pid] = val; }
							// if (par == '$Start') { Start[ent.Pid] = val; }
						}
						ent[par] = await symbol(val);
					}
					ents.push(ent);
				}

				let entsPromise = [];

				for (let par of ents) {
					entsPromise.push((async function () {
						let impkey = modnam + '/'+ par.Entity;
						if (!(impkey in ImpCache)) {
							let entString = await new Promise(async (res, _rej) => {
								if (!(par.Entity in mod.files)){
									log.e('Entity <'+par.Entity+'> not in Module <' + modnam + '>');
									process.exit(1);
									return;
								}
								mod.file(par.Entity).async('string')
									.then((string) => res(string));
							});
							ImpCache[impkey] = indirectEvalImp(impkey, entString, log,
								createRequireFromModuleType(modnam));
						}
						EntCache[par.Pid] = new Volatile(new Entity(Nxs, ImpCache[impkey], par, log));
						cacheInterface.EntIndex[par.Pid] = par.Apex;
					})());
				}
				await Promise.all(entsPromise);

				async function symbol(val) {
					if (typeof val === 'object') {
						if (Array.isArray(val)) {
							val.map(v => symbol(v));
							val = await Promise.all(val);
						} else {
							for (let key in val) {
								val[key] = await symbol(val[key]);
							}
						}
						return val;
					}
					if (typeof val !== 'string')
						return val;
					let sym = val.substr(1);
					if (val.charAt(0) === '#' && sym in Local)
						return Local[sym];
					if (val.charAt(0) === '\\')
						return sym;
					return val;
				}
			}
Generate array of entities from module
Module must be in cache

@param {string} pidapx 		The first parameter is the pid assigned to the Apex
@param {object} inst
@param {string} inst.Module	The module definition in dot notation
@param {object} inst.Par		The par object that defines the par of the instance
@param {boolean} saveRoot	Add the setup and start functions of the
apex to the Root.Setup and start