just from importlib import reload, and then do the stuff you did in py2, maybe it just works. As I said, I had limited success with reload, with both py2 and py3, and I can't really tell you much.
possible to write python code from extetrnal editor and run in freecad?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: possible to write python code from extetrnal editor and run in freecad?
I have this hack for when I want to play with an object created somewhere deep in a script:Bad Blue Bull wrote: ↑Sun Sep 01, 2019 2:52 pm I don't know how to access stuff created in this scirpt from console.
Like I assign a value to a variable x, how can I access the variable from console?
insert this to your script:
Code: Select all
#debug
FreeCADGui.doCommand(
'import ctypes\n'
'my_stupid_faulty_object = ctypes.cast({id}, ctypes.py_object).value'.format(id= repr(id(x)))
)
Re: possible to write python code from extetrnal editor and run in freecad?
Why so complicated? Just edit your .py file with the (external) editor you want and save. But I don't know, if its working with own workbenches too, but for macros, it works fine. (I write my macros only with an external editor)
usbhub
usbhub