otoole uses the Amply package to read a GNU Math Prog datafile into a Python dict of pandas DataFrames.
For example
from otoole.read_strategies import ReadDatafile
filepath = 'path/to/kenya.txt'
strategy = ReadDatafile()
osemosys_model, default_values = strategy.read(filepath)
This might be a nice way then edit the model, by adding new rows to the pandas dataframes and then writing out the model using a write strategy:
from otoole.write_strategies import WriteDatafile
filepath = 'path/to/kenya_gis.txt'
strategy = WriteDatafile()
strategy.write(filepath, osemosys_model, default_values)