function loadScope(scope, data) {
    const ML = moduleList.slice(); // Module List copy
    scope.restrictedCircuitElementsUsed = data.restrictedCircuitElementsUsed;

    // Load all nodes
    data.allNodes.map((x) => loadNode(x, scope));

    // Make all connections
    for (let i = 0; i < data.allNodes.length; i++) { constructNodeConnections(scope.allNodes[i], data.allNodes[i]); }
    // Load all modules
    for (let i = 0; i < ML.length; i++) {
        if (data[ML[i]]) {
            if (ML[i] === 'SubCircuit') {
                // Load subcircuits differently
                for (let j = 0; j < data[ML[i]].length; j++) { loadSubCircuit(data[ML[i]][j], scope); }
            } else {
                // Load everything else similarly
                for (let j = 0; j < data[ML[i]].length; j++) {
                    loadModule(data[ML[i]][j], scope);
                }
            }
        }
    }
    // Update wires according
    scope.wires.map((x) => {
        x.updateData(scope);
    });
    removeBugNodes(scope); // To be deprecated

    // If Verilog Circuit Metadata exists, then restore
    if (data.verilogMetadata) {
        scope.verilogMetadata = data.verilogMetadata;
    }

    // If Test exists, then restore
    if (data.testbenchData) {
        globalScope.testbenchData = new TestbenchData(
            data.testbenchData.testData,
            data.testbenchData.currentGroup,
            data.testbenchData.currentCase
        );
    }

    // If layout exists, then restore
    if (data.layout) {
        scope.layout = data.layout;
    } else {
        // Else generate new layout according to how it would have been otherwise (backward compatibility)
        scope.layout = {};
        scope.layout.width = 100;
        scope.layout.height = Math.max(scope.Input.length, scope.Output.length) * 20 + 20;
        scope.layout.title_x = 50;
        scope.layout.title_y = 13;
        for (let i = 0; i < scope.Input.length; i++) {
            scope.Input[i].layoutProperties = {
                x: 0,
                y: scope.layout.height / 2 - scope.Input.length * 10 + 20 * i + 10,
                id: generateId(),
            };
        }
        for (let i = 0; i < scope.Output.length; i++) {
            scope.Output[i].layoutProperties = {
                x: scope.layout.width,
                y: scope.layout.height / 2 - scope.Output.length * 10 + 20 * i + 10,
                id: generateId(),
            };
        }
    }
    // Backward compatibility
    if (scope.layout.titleEnabled === undefined) { scope.layout.titleEnabled = true; }
}
Function to load a full circuit
@param {Scope} scope
@param {JSON} data
@category data