Unable to make changes to config.ini

I am not sure how to provide all of the information, so I will post it below and see if anyone spots something obvious… I have a main.py, an ini_manager.py and of course config.ini. All files are in the same directory
I have no issue with config.get, that is working as expected. when I attempt to use config.set, the file time stamp updates but the data does not…

main.py:

import ini_manager

new_word='4500'

	resume = ini_manager.get_resume_point() 
	print('last word read before update: ', resume)
	print(f'updating last word read to {new_word}')
	ini_manager.set_resume_point(new_word)
	print('last word read after update: ', resume)

===================================================
output returned:
last word read before update: 800
updating last word read to 4500
inside function…New resume point before: 4500
last word read after update: 800

config.ini:

[user]
username = 'bob'

[global_settings]
global_theme = 'dark'

[book0000]
title = "Library of the World's Best Literature vol1.txt"
readspeed = .5
wordsinrow = 3
rows = 2
lastword_read = 800

===================================================
ini_manager.py:

import configparser

config = configparser.ConfigParser()
config.read('config.ini')

def write_config(section, key, new_value):
    config.set(section, key, new_value)

def get_resume_point():
	resume_from = config.get('book0000', 'lastword_read')
	return resume_from

def set_resume_point(new_word):
	print(f"inside function...New resume point before: {new_word}")
	write_config('book0000', 'lastword_read', '4500')

with open('config.ini', 'w') as configfile:
    config.write(configfile)
    configfile.flush()

In ini_manager.py, set_resume_point changes the config value in memory, but doesn’t write it back out to disk, and main.py doesn’t get the new value of “resume” after the update, so the variable resume still has the old value.

Another point to note: in ini_manager.py, the config is being read in at the top when the module is imported, which is fine, but it’s also being written back out again at the end, also when the module is imported, which is pointless.

I would rather say that there isn’t a “new value” to get, in the first place. Just like how c = a * b computes a value for c immediately, and does not cause c to update if a and/or b update.

I think that write was intended to be indented within set_resume_point.

Thanks! I clearly did not realize that and can work I cleaning this up!

Thank you! the indentation was the culprit I was missing!