What's new

How do I call a function from within AlibreScript

oldfox

Alibre Super User
How can something so simple in Python be so "un-simple" in AlibreScript? :confused:
***************************************
Item = 'Test'
print 'Line 2'
if Item == 'Test':
print 'Line 4'
Test()
print 'Line 6'
def Test():
print "This is the function 'Test()'"
***************************************
I get the error: 'Test' is not defined :eek:
 

idslk

Alibre Super User
Hello Chris,

you've tried to use the function Test() before you've defined the function.
First def than use...
Code:
#***************************************
Item = 'Test'
print 'Line 3'
if Item == 'Test':
  print 'Line 4'
print 'Line 6'
def Test():
  print "This is the function 'Test()'"
#***************************************
print 'Item:',Item
Test()

Regards
Stefan
 

oldfox

Alibre Super User
Hi Stefan,

First def than use...
And I used to know that (still do)
I was trying to make one script to do a number of related things. So far it has over 500 lines of code. That tells me to "modularize".
So I'm going to just slice and dice it into at least 3 separate scripts. After all, it is pretty easy to just open the one you want to use. (or all 3)

Funny, I can remember electronic formulas learned more than 50 years ago, and then with this, try to get the tail to wag the dog.
It has simply become too cumbersome. Oh well, live, have fun and learn.

Thanks again,
Chris
 
Top