0

So I'm trying refactor some code I did in a single file into some more managable pieces. However, I cannot figure out how to do imports within my own files to save my life.

I want to use mytest in sandbox.py. What is the correct syntax to do that? I have attached photos of the directory structure. I'm using Python 3.8.2

enter image description here enter image description here

sasquatch
  • 285
  • 2
  • 13

1 Answers1

0

Create testdir as package by creating __init__.py file in testdir

How to import insandbox.py

from testdir import testfile

a = testfile.mytest(something)

PSKP
  • 1,178
  • 14
  • 28