Problem with importing a script

Forum Forums Visual Components 4.0 Python Programming in VC Problem with importing a script

This topic contains 2 replies, has 2 voices, and was last updated by Avatar Dubs3pp 1 year, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6164
    Avatar
    Dubs3pp
    Participant

    Hey there!

    I have the following code to import a python-script from my harddrive into a script-behaviour.

    Works fine for script_r.Script, but i need the same script in another component aswell (script_l) and that doesn’t work.

    I do not get any errors, but the simulation stops before print “THREE” and after I click play a second time my code restarts skipping the function this time because I also create some behaviours in this function and I put in an if-statement so it wont run a second time. But why does my code stop at this point?

    Best regards
    Dubsepp

    #6173
    Avatar
    Ralle
    Participant

    I guess it is only possible to change the content of a script when the simulation isn’t running and also not started.

    I think when changing the content of script_r, the simulation will be stopped. Thats why the print of THREE won’t appear.

    Is there any reason why you are changing a python script during the simulation run? I assume it is not possible.

     

    #6179
    Avatar
    Dubs3pp
    Participant

    Hey Ralle,

    well i want the intelligence of the robot and other connected components to be created through my conveyor, so i can change robots without having to prepare them manually. The script only gets written once a new robot gets connected to my conveyor, after that it skips this function.

    I guessed so too after a view tries. VC probably tries to execute this imported script but it’s all signal based, so nothing is happening.

    I think i’ll have to create a button to write the scripts then.

    Thanks Ralle!

     

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.