Script not working as a function

Script not working as a function

brad.bylls
Collaborator Collaborator
502 Views
1 Reply
Message 1 of 2

Script not working as a function

brad.bylls
Collaborator
Collaborator

I have created a script that works just fine.

I copied and pasted that script to make it an add-in, works just fine.

Now I want to call that script from another script, so I made it a function, import it into the main script, call the function, it runs to a certain point and stops.

I added this at the top of the script to make it a function:

def createShcs():
and call it from the main script:
SHCS.createShcs()

It stops at 

def drawBolt(designnumBoltBodyLengthnumBoltClearanceLengthnumBoltBodyDiamnumBoltHeadDiamnumBoltHeadHeightnumBoltHexSizenumBoltHeadFilletnumBoltTapDrillnumBoltClearDiamnumBoltCboreDiamnumThreadEngage😞
 
Like I said earlier, this runs just fine as a stand alone script, but not as a function  script.
Any ideas?
Brad Bylls
0 Likes
503 Views
1 Reply
Reply (1)
Message 2 of 2

OceanHydroAU
Collaborator
Collaborator

The caller probably needs to pass the master fusion360 object ( adsk.core.Application.get() ) into the function, in order for that function to be able to access the things it needs to do its job.

 

Perhaps you're using the wrong words as well?  If it's in some other file, it's probably a module (not a function) right?

 

Post your code if you want us to fix it for you.

0 Likes