问题是;
var instance = mScriptScope.GetVariable("Group1"); //here I can get the instance named "Group1" ,type is IronPython.Runtime.Types.OldInstance
mScriptScope.Engine.Execute(context);//but here I excute Group1.Collection1.Tag1 =10 throw an UnBoundNameException : global name 'Group1' is not defined
mScriptScope是从.py文件创建的:
# -*- coding: utf-8 -*-
import RTDBBase
from RTDBBase import *
Group1 = PRTDBTagGroup("Group1")
为什么?
答案 0 :(得分:0)
好的,如果想要执行组1.Collection 1.Tag 1 = 10,我应该这样做:
ScriptSource source = mScriptScope.Engine.CreateScriptSourceFromString("Group1.Collection1.Tag1 =10", SourceCodeKind.Statements);
source.Execute(mScriptScope);