html is just text, often very repetitive. I have a simple homework webpage. I'm trying to automate the webpage production.
I have Python routines for producing html (I made them, so they are primitive, but they all work):
makeCheckboxes.py
makeDropdownboxes.py
makehtmlTable.py
makeRadiobuttons.py
makeTextboxes.py
makeThankyouPHP.py
and lastly:
makeWebpage.py
They all just output a text file.
Rather than lump all these in one very big, long file (I lose the plot easily), I'd like to call the one or ones I want from makeWebpage.py and run it, then knot the sections together into 1 text file.
They are all in /home/pedro/textTohtml/ I run them in a bash terminal.
I don't need all the routines each week.
All I need to know is, how many sections I want and what's in it.
For example, let's say next week: Section 1 is radio buttons, Section 2 is Textboxes (fill in the gaps exercise)
Can I call the 2 routines from makeWebpage.py without actually defining them within as functions?
The functions themselves produce a text file which I can then open and integrate into the webpage template.
EDIT: Thanks for the answers. What I need is to import the whole file, each of which will then have its own inner functions. If I do this:
import file as fl
Will it then run fl? Or is it better to run subprocess?