Ich have one python file where I declare my variables and a second file containing more functions (in this example only one function). I can't seem to figure out how to pass on the variables from one.py to two.py.
one.py:
import two
a=1
b=2
c=3
dict={'ONE':a,'TWO':b,'THREE':c}
two.py:
def f():
d=a+b+c
return d
two.f() should return:
6
Thanks in advance
EDIT:
It's working fine in the command line in the mean time. But for some reason doesn't want to work when I run the script in Abaqus. It says:
count=two.f(my_dictionary)
AttributeError:'Module' object has no attribute 'f'
First of all create a module to make 'import two' work. - Create a directory and put a blank init.py file there, two.py and one.py.
Your two.py should be:
def f(x):
return x['ONE']+x['TWO']+x['Three']
Your one.py should be:
import two
a=1
b=2
c=3
my_dictionary={'ONE':a,'TWO':b,'THREE':c}
two.f(my_dictionary)