I googled this but not finding a good solution so I thought I’d ask here …
I have two libraries that require functions from each other … I can’t include them in each other without creating a circular definition …
For now, I’m just repeating the library function where I need it, which is sub-optimal. Maybe it’s a matter of rethinking whats in what library module?
I’m assuming someone else here has run across this. It’s making my head hurt … what am I missing?
Well, ok I tried that … and it still gives an error (using your example as a test)
2022-07-18 11:18:42.173 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab/automation/jsr223/python/personal/test.py': ImportError: cannot import name func_a in /etc/openhab/automation/jsr223/python/personal/test.py at line number 1
test_a.py contains:
import personal.file_a
reload(personal.file_a)
from personal.file_a import func_a
Just to be clear, both file_a and file_b are in the library … test.py is in personal space.
2022-07-19 09:18:04.413 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/personal/test_circ.py': RuntimeError: maximum recursion depth exceeded (Java StackOverflowError) in /openhab/conf/automation/jsr223/python/personal/test_circ.py at line number 6
Thanks @lukics … I was hoping I was just missing something (other than bad design) … I think the easiest solution is to add a 3rd library that contains the common function.