I made a package that needs to import other packages like pandas and numpy. Here is the basic dir structure:
main.py my_pkg/ __init__.py test.py test.py contains something like this (I do not import anything)
def function(): foo=pd.read_csv(....) I tried doing this in main.py:
import pandas as pd import numpy as np from my_pkg import test test.function() But I get this error:
NameError: name 'pd' is not defined How do I import pandas and numpy so that test.function() is able to use them?
没有评论:
发表评论