##abc.py
import lib
data = lib.bagwords(X)
This above will throw an error because X is not defined, but at least it code demonstrates how to get data from the lib.bagwords() function.
OK - from the comment ("No, X is defined in abc.py, my problem is: it'll have error: module lib has no attribute bagwords, i don't know why.") is known that X is defined in abc.py, so there will be no error because of that
One possible reason for the error mentioned in the comment is if there is ANOTHER module named lib in the search path and it is found and loaded first. So how to avoid the error?
Rename lib.py to myLibrary.py and use the code:
##abc.py
import myLibrary
data = myLibrary.bagwords(X)
I have tested that it works, so it should work also for you :) .
Happy coding!
bagwordsfunction doesn't accept any parameters.bagwordsvsbadwords), it seems that you know how to do this. All the parts are in place.