# Import a r6rs library from another r6rs library in the same directory?

**URL:** <https://racket.discourse.group/t/import-a-r6rs-library-from-another-r6rs-library-in-the-same-directory/2691>\
**Category:** Questions & Answers\
**Created:** [January 30, 2024, 10:02pm UTC](https://racket.discourse.group/t/import-a-r6rs-library-from-another-r6rs-library-in-the-same-directory/2691 "2024-01-30T22:02:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![awwx](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@awwx](https://racket.discourse.group/u/awwx)\
**Post date:** [January 30, 2024, 10:02pm UTC](https://racket.discourse.group/t/import-a-r6rs-library-from-another-r6rs-library-in-the-same-directory/2691/1 "2024-01-30T22:02:30Z")

</div>

I can easily require a r6rs library file in the same directory from a Racket program:

a1.rkt:

```scheme
#lang racket

(require "b2.rkt")

(foo)

```

a2.rkt:

```scheme
#!r6rs

(library (a2)
  (export foo)
  (import (rnrs))

  (define (foo)
    "hello, this is foo"))

```

```scheme
$ racket a1.rkt 
"hello, this is foo"

```

Now I want to import a second r6rs library from my first one:

b1.rkt:

```scheme
#lang racket

(require "b2.rkt")

(foo)

```

b2.rkt:

```scheme
#!r6rs

(library (b2)
  (export foo)
  (import (rnrs) ???)

  (define (foo)
    (bar)))

```

b3.rkt:

```scheme
#!r6rs

(library (b3)
  (export bar)
  (import (rnrs))

  (define (bar)
    "hello, this is bar"))

```

Looking at [5&nbsp;Libraries and Collections](https://docs.racket-lang.org/r6rs/libpaths.html) it appears that all valid r6rs library names reference a directory path, so maybe the best I can do is put `b3.rkt` in a subdirectory?

b2.rkt:

```scheme
#!r6rs

(library (b2)
  (export foo)
  (import (rnrs) (b b3))

  (define (foo)
    (bar)))

```

Moving `b3.rkt` into a subdirectory `b`, I can use:

```scheme
racket -S . b1.rkt

```

and that works.
