The code in MyFramework must always refer to a variable (or other registry mechanism) to find the name or reference to use.
At startup time (if each process only loads one application) or at the start of each request (if a persistent interpreter serves multiple applications), load the appropriate MyApp modules and store their names or references in the variables/registry.
It sounds like you've got the first but not the second.