Question: I have some problem with my project, i'm making application in .net core but i also need to create api, i want to make "wcf service" and now i can't use class from other project in solution becouse wcf is in .net framework :\ example below.

```
namespace Example.Data //This is class library
{
    public class Assortment:MainFields
    {
        public string Code { get; set; }

        public string EANCode { get; set; }
    }
}

namespace WcfService1 //This is wcf service
{
    public class Service1 : IService1
    {
        public string ReturnAssortmentWithEanCode(string EANCode)
        {
            return (new Assortment(EANCode, "Test"));
        }
    }
}

```

In WcfService1 i can't use "Using Example.Data;"

Answer: 
Although @SunPodder already told you how to solve the problem, using `globals()` shouldn't be the correct approach. Creating variables dynamically is generally a bad idea, especially when you want to create a collection of similar objects.

A better solution is to store the `Turtle` objects in a dictionary. You should also loop through the names directly, instead of using `range`. Even better, is to loop through the pairs `(name, color)` using `zip`.

```
class Turtle:
    def __init__(self, shape):
        self.shape = shape

# Note: There are 5 names, but 6 colors (the 'orange' color will be ignored)
turtle_names = ["tim", "bill", "ben", "alan", "william"]
turtle_colors = ["red", "blue", "purple", "green", "yellow", "orange"] 
turtles = {}

for name, color in zip(turtle_names, turtle_colors):
    new_turtle = Turtle(shape="turtle")
    new_turtle.color = color 
    turtles[name] = new_turtle

```

E.g. then you can access the turtle named "tim" using `turtles["tim"]`.

```
>>> turtles 

{'tim': <__main__.Turtle at 0x12b291880>,
 'bill': <__main__.Turtle at 0x12b291a60>,
 'ben': <__main__.Turtle at 0x12b2919a0>,
 'alan': <__main__.Turtle at 0x12b291190>,
 'william': <__main__.Turtle at 0x12b291e50>}

>>> turtles["tim"]

<__main__.Turtle at 0x12b291880>

>>> turtles["tim"].color
'red'

```

---

Lastly, I don't understand why the attribute color is not initialized in the constructor. If you define `Turtle.__init__` as something similar to

```
class Turtle:
    def __init__(self, shape, color):
        self.shape = shape
        self.color = color 

```

You can just use a dictionary comprehension

```
turtle_names = ["tim", "bill", "ben", "alan", "william"]
turtle_colors = ["red", "blue", "purple", "green", "yellow", "orange"]

turtles = {name: Turtle(shape="turtle", color=color) 
           for name, color in zip(turtle_names, turtle_colors)}

```
With `new_turtle` you are actually accessing a string and not a Turtle object.

Just change your code a litte bit.
This works for me.

```
Turtle_names = ["tim", "bill", "ben", "alan", "william"]
Turtle_colors = ["red" "blue", "purple", "green", "yellow", "orange"]
Turtles = []

for i in range(len(Turtle_names)):
    globals()[Turtle_names[i]] = Turtle(shape="turtle")
    globals()[Turtle_names[i]].color = Turtle_colors[i]
    Turtles.append(globals()[Turtle_names[i]])

```