Вы пытаетесь вызвать func
как функцию, когда это действительно строка, которую вы построили из аргумента командной строки.
Для ваших целей, как также упоминалось в связанном посте prashant, вы можете использовать что-то вроде модуля imp .
Вот краткий пример
import sys
import imp
# `imp.load_source` requires the full path to the module
# This will load the module provided as `user_selection`
# You can then either `import user_selection`, or use the `mod` to access the package internals directly
mod = imp.load_source("user_selection", "/<mypath>/site-packages/pytz/__init__.py")
# I'm using `user_selection` and `mod` instead of `pytz`
import user_selection
print(user_selection.all_timezones)
print(mod.all_timezones)
В вашем случае вам, возможно, придется использовать imp.find_module
, чтобы получить полный путь только из имени, или указать полный путь непосредственно в командной строке.
Это должно быть отправной точкой
import sys
import imp
file_name = sys.argv[1]
f, filename, desc = imp.find_module(file_name, ['/path/where/modules/live'])
mod = imp.load_module("selected_module", f, filename, desc)
mod.scrap()