I am attempting to call a function from another file called 'run_ES_15M_Trend_Identifier':
import sys
import os
sys.path.append(os.path.abspath(r"C:\Users\cost9\OneDrive\Documents\PYTHON\Daily Tasks\Individual Trading\ES"))
from ES_15M_Trend_Identifier import run_ES_15M_Trend_Identifier
So the above function comes from the ES_15M_Trend_Identifier py file. I just ran that file from its own directory and it works perfect - modifies the dataframe, sends to csv. So the error isn't coming from the function itself. Instead I get the error:
ImportError: cannot import name run_ES_15M_Trend_Identifier
I realize there might be something circular about this process from other SO posts, but I'm not sure how to fix it.
edit: I've also tried:
from ES_15M_Trend_Identifier import *
run_ES_15M_Trend_Identifier()
which gives the error:
NameError: name 'run_ES_15M_Trend_Identifier' is not defined
edit: Here's the function, which works when I run it in its own file:
def run_ES_15M_Trend_Identifier():
# Do stuff to pandas dataframe, including some for loops that fill out additional columns - this function works on the original file
path_to_csv = "C:\\Users\\cost9\\OneDrive\\Documents\\PYTHON\\Daily Tasks\\Individual Trading\\ES\CSV\\15M\\Trend_Identifier\\ES_15M_Summary.csv"
ES_15M_Summary_Reduced.to_csv(path_or_buf = path_to_csv)
Is both files are in the same directory? if not put both files in the same folder!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.