So, I'm pretty new to chaquopy and was wondering if there's anyway to get newly generated (ie: written post-build, while the app is running) .py files to run?
What I mean is: Say I save the contents of a textEdit view into a file named 'newFile.py', and it goes into some specified external storage location. Is there anyway to specify that externalStorageDir in advance via source sets (which, as far as I can tell, only apply to src directories and not externalStorage) or something else so that getModule() can later locate it, making the functions in the newly written file callable?
Pretty niche question I know, but this package has me thinking of all kinds of possibilities.
You can modify sys.path
at runtime, like this:
py.getModule("sys").get("path").callAttr("append", yourExternalDirectory);
And now any Python files in that directory can be loaded using py.getModule
.