#πŸ”’ import file

8 messages Β· Page 1 of 1 (latest)

dapper knoll
#

Good evening, how can I import the testt.py file into typess.py please? For information, I tried with an __init__.py file in the main folder and use from .. import testt but I have a nasty import error: attempted relative import with no known parents package I tried with sys and os but it's worse.
-# I can speak in French too xd
thank you in advance for your solutions

drowsy prairieBOT
#

@dapper knoll

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

deep scroll
dapper knoll
ashen tusk
#

You can't import a file from a directory above the main file without modifying sys.path

#
import sys
sys.path.insert(0, "..")
import testt
drowsy prairieBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.