Hi guys,
as a simplification of my problem, I created an external file test.py with the following code:
n = aaa
if n <= 5:
n += 1
else:
n += 2
meanwhile, inside the Ironpython script in dynamo I have:
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
sys.path.append("C:\\Users\\.....") # test.py location
aaa = IN[0]
from test import *
OUT = n
global name “aaa” is not defined, beacuse inside test.py it’s not.
And now the question: is there a way to make the variable aaa readable in test.py?
Thanks in advance!
I don’t think this is possible, although I may be wrong. Is there any specific reason you’re trying to do this? If I were you, I would treat your python node in Dynamo as your main.py and import functions from test.py as if it were a module.
Thanks @cgartland for the quick answer.
I thought about it as well. But the main reason for it is that I’m going to use my test.py more than one time in different python node and the code is not so simple… so if I have to modify it, I only do it once…