Variable function calling (Another Way)

I just wrote the following post in response to the topic variable function calling but then it was locked so I’m posting my solution here:

number = 2
setattr(app.testModule,"value%s"% number, 4)

To make this a little easier you could put this function in app.testModule:

def setValue(number,value):
	import app
	setattr(app.testModule,"value%s"% number, value)

Then you could use:

number = 2
app.testModule.setValue(number, 4)