It looks like you’re defining df
in the scope of your parse_contents
function, not globally, so when you instantiate your Dash components you’re trying to reference a variable that doesn’t exist in its scope. (Actually when Python gets to that point, parse_contents
won’t have been executed yet either, just defined, so it doesn’t exist yet in any scope.)