Hello guys,
behind this heading lies nothing more than the wish two write functions in jython, saving them in a separate file and calling them from the main script.
Why? Just to try to keep the code more manageable.
I am no programmer at all. Learnt a little bit of Pascal and C/C++ in my youth.
My computer is a Elitebook bought on a fleamarket many years ago.
Java version is 11.0.5 64-bit
Windows 10 Version 1903 for x64 (KB4522741)
JMRI 4.17.3
Loconet simulator
Python has a import function.
If I hava a function test in a file called my-functions.py
I hoped that I was able to import?the function with this code
import my-functions
my-functions.test()
I doesn't work. Nothing happenes.
Well the latter is not quite the truth :-)
When i run the code with the Message Log window open?the whole JMRI crashes. I even have to go kill Java manually to start JMRI again. Without the Log Window opened I can just continue, everything is just fine.
But my question is about the import function. Can I use it in jython or do I have to live with having the functions in the main script?
MVH
Dag Cato