In this case, Classifier isn't the module or a sub-module, it's something you've imported from the FilterFile module (from-imports actually still import everything from the module, but only allow you to access what you've requested).
You need to do import FilterFile instead (you can still do something like import FilterFile as foo, as long as the thing you're reloading is a reference to the actual module).
I tested the following as my Classifier function (the same logic applies for classes and such):
def Classifier():
print('before')
While testing, I would change 'before' to 'after' during a delay. When I tried the following, no error occurred but Classifier didn't actually update unless called through the module:
import time
import FilterFile as bar
from importlib import reload
from FilterFile import Classifier as foo
foo() # "before"
time.sleep(3.5) # (a delay so I could change `Classifier`)
reload(bar)
foo() # "before" <- wrong!!!
bar.Classifier() # "after"
However, you can redo the from-import to update it:
import time
import FilterFile as bar
from importlib import reload
from FilterFile import Classifier as foo
foo() # "before"
time.sleep(3.5) # (a delay so I could change `Classifier`)
reload(bar)
from FilterFile import Classifier as foo
foo() # "after" <- hooray!!!
I recommend wrapping importlib.reload() in your own function that also redoes your from-imports. There might be a hacky way to do this without needing a true import statement and without redoing the from-imports, but I hope this is acceptable for your purposes.
Classifieris the actual function, rather than a submodule containing the function (I can't tell from the details you posted).importlib.reload()only deals with entire modules, not objects contained within them - but you haven't imported the module itself, so there is nothing you can validly pass toreload(). You need to write this asimport FilterFileandreload(FilterFile)- the function would be referred to asFilterFile.Classifier. If you still want to usefrom FilterFile import Classifier as foo, you'd have to repeat that line after EVERY reload.