Python Forum
using Python as an program's internal scripting system - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: using Python as an program's internal scripting system (/thread-20399.html)



using Python as an program's internal scripting system - Skaperen - Aug-08-2019

i will develop a program ... it might be in C ... it might be in Pike ... it might be in Python3 ... and the program needs a scripting system to run "internally". one of the programs is a 2D image builder for websites to do things like draw simple shapes with parameters from the web request. the internal scripting will take these parameters and use them with various web shape primitives to construct the 2D image.

what i would like is for this scripting system to be based on the Python3 language so that it will be familiar to Python coders. but it will need a simple way to get the parameters and do various basic image construct actions. making this like a function seems reasonable. what i'd like to know is what are the best things to read to learn about this.

i can envision a way to do this when the base program itself is in Python3 which is to read the file that script is in, set up an environment, and call exec() with that environment. it would call mrthods in classes and in modules that set up final details for the rendering phase.